
obj/user/faultallocbad.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 8c 00 00 00       	call   8000bd <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <handler>:

#include <inc/lib.h>

void
handler(struct UTrapframe *utf)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	53                   	push   %ebx
  80003b:	83 ec 0c             	sub    $0xc,%esp
	int r;
	void *addr = (void*)utf->utf_fault_va;
  80003e:	8b 45 08             	mov    0x8(%ebp),%eax
  800041:	8b 18                	mov    (%eax),%ebx

	cprintf("fault %x\n", addr);
  800043:	53                   	push   %ebx
  800044:	68 e0 1f 80 00       	push   $0x801fe0
  800049:	e8 c8 01 00 00       	call   800216 <cprintf>
	if ((r = sys_page_alloc(0, ROUNDDOWN(addr, PGSIZE),
  80004e:	83 c4 0c             	add    $0xc,%esp
  800051:	6a 07                	push   $0x7
  800053:	89 d8                	mov    %ebx,%eax
  800055:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  80005a:	50                   	push   %eax
  80005b:	6a 00                	push   $0x0
  80005d:	e8 cf 0b 00 00       	call   800c31 <sys_page_alloc>
  800062:	83 c4 10             	add    $0x10,%esp
  800065:	85 c0                	test   %eax,%eax
  800067:	78 16                	js     80007f <handler+0x4c>
				PTE_P|PTE_U|PTE_W)) < 0)
		panic("allocating at %x in page fault handler: %e", addr, r);
	snprintf((char*) addr, 100, "this string was faulted in at %x", addr);
  800069:	53                   	push   %ebx
  80006a:	68 2c 20 80 00       	push   $0x80202c
  80006f:	6a 64                	push   $0x64
  800071:	53                   	push   %ebx
  800072:	e8 17 07 00 00       	call   80078e <snprintf>
}
  800077:	83 c4 10             	add    $0x10,%esp
  80007a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80007d:	c9                   	leave  
  80007e:	c3                   	ret    
		panic("allocating at %x in page fault handler: %e", addr, r);
  80007f:	83 ec 0c             	sub    $0xc,%esp
  800082:	50                   	push   %eax
  800083:	53                   	push   %ebx
  800084:	68 00 20 80 00       	push   $0x802000
  800089:	6a 0f                	push   $0xf
  80008b:	68 ea 1f 80 00       	push   $0x801fea
  800090:	e8 9a 00 00 00       	call   80012f <_panic>

00800095 <umain>:

void
umain(int argc, char **argv)
{
  800095:	f3 0f 1e fb          	endbr32 
  800099:	55                   	push   %ebp
  80009a:	89 e5                	mov    %esp,%ebp
  80009c:	83 ec 14             	sub    $0x14,%esp
	set_pgfault_handler(handler);
  80009f:	68 33 00 80 00       	push   $0x800033
  8000a4:	e8 99 0d 00 00       	call   800e42 <set_pgfault_handler>
	sys_cputs((char*)0xDEADBEEF, 4);
  8000a9:	83 c4 08             	add    $0x8,%esp
  8000ac:	6a 04                	push   $0x4
  8000ae:	68 ef be ad de       	push   $0xdeadbeef
  8000b3:	e8 a9 0a 00 00       	call   800b61 <sys_cputs>
}
  8000b8:	83 c4 10             	add    $0x10,%esp
  8000bb:	c9                   	leave  
  8000bc:	c3                   	ret    

008000bd <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000bd:	f3 0f 1e fb          	endbr32 
  8000c1:	55                   	push   %ebp
  8000c2:	89 e5                	mov    %esp,%ebp
  8000c4:	56                   	push   %esi
  8000c5:	53                   	push   %ebx
  8000c6:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8000c9:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8000cc:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8000d3:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8000d6:	e8 10 0b 00 00       	call   800beb <sys_getenvid>
  8000db:	25 ff 03 00 00       	and    $0x3ff,%eax
  8000e0:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8000e3:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8000e8:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8000ed:	85 db                	test   %ebx,%ebx
  8000ef:	7e 07                	jle    8000f8 <libmain+0x3b>
		binaryname = argv[0];
  8000f1:	8b 06                	mov    (%esi),%eax
  8000f3:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  8000f8:	83 ec 08             	sub    $0x8,%esp
  8000fb:	56                   	push   %esi
  8000fc:	53                   	push   %ebx
  8000fd:	e8 93 ff ff ff       	call   800095 <umain>

	// exit gracefully
	exit();
  800102:	e8 0a 00 00 00       	call   800111 <exit>
}
  800107:	83 c4 10             	add    $0x10,%esp
  80010a:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80010d:	5b                   	pop    %ebx
  80010e:	5e                   	pop    %esi
  80010f:	5d                   	pop    %ebp
  800110:	c3                   	ret    

00800111 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800111:	f3 0f 1e fb          	endbr32 
  800115:	55                   	push   %ebp
  800116:	89 e5                	mov    %esp,%ebp
  800118:	83 ec 08             	sub    $0x8,%esp
	close_all();
  80011b:	e8 b2 0f 00 00       	call   8010d2 <close_all>
	sys_env_destroy(0);
  800120:	83 ec 0c             	sub    $0xc,%esp
  800123:	6a 00                	push   $0x0
  800125:	e8 7c 0a 00 00       	call   800ba6 <sys_env_destroy>
}
  80012a:	83 c4 10             	add    $0x10,%esp
  80012d:	c9                   	leave  
  80012e:	c3                   	ret    

0080012f <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  80012f:	f3 0f 1e fb          	endbr32 
  800133:	55                   	push   %ebp
  800134:	89 e5                	mov    %esp,%ebp
  800136:	56                   	push   %esi
  800137:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800138:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  80013b:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800141:	e8 a5 0a 00 00       	call   800beb <sys_getenvid>
  800146:	83 ec 0c             	sub    $0xc,%esp
  800149:	ff 75 0c             	pushl  0xc(%ebp)
  80014c:	ff 75 08             	pushl  0x8(%ebp)
  80014f:	56                   	push   %esi
  800150:	50                   	push   %eax
  800151:	68 58 20 80 00       	push   $0x802058
  800156:	e8 bb 00 00 00       	call   800216 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80015b:	83 c4 18             	add    $0x18,%esp
  80015e:	53                   	push   %ebx
  80015f:	ff 75 10             	pushl  0x10(%ebp)
  800162:	e8 5a 00 00 00       	call   8001c1 <vcprintf>
	cprintf("\n");
  800167:	c7 04 24 f3 24 80 00 	movl   $0x8024f3,(%esp)
  80016e:	e8 a3 00 00 00       	call   800216 <cprintf>
  800173:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800176:	cc                   	int3   
  800177:	eb fd                	jmp    800176 <_panic+0x47>

00800179 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800179:	f3 0f 1e fb          	endbr32 
  80017d:	55                   	push   %ebp
  80017e:	89 e5                	mov    %esp,%ebp
  800180:	53                   	push   %ebx
  800181:	83 ec 04             	sub    $0x4,%esp
  800184:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800187:	8b 13                	mov    (%ebx),%edx
  800189:	8d 42 01             	lea    0x1(%edx),%eax
  80018c:	89 03                	mov    %eax,(%ebx)
  80018e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800191:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800195:	3d ff 00 00 00       	cmp    $0xff,%eax
  80019a:	74 09                	je     8001a5 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80019c:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8001a0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8001a3:	c9                   	leave  
  8001a4:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8001a5:	83 ec 08             	sub    $0x8,%esp
  8001a8:	68 ff 00 00 00       	push   $0xff
  8001ad:	8d 43 08             	lea    0x8(%ebx),%eax
  8001b0:	50                   	push   %eax
  8001b1:	e8 ab 09 00 00       	call   800b61 <sys_cputs>
		b->idx = 0;
  8001b6:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001bc:	83 c4 10             	add    $0x10,%esp
  8001bf:	eb db                	jmp    80019c <putch+0x23>

008001c1 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8001c1:	f3 0f 1e fb          	endbr32 
  8001c5:	55                   	push   %ebp
  8001c6:	89 e5                	mov    %esp,%ebp
  8001c8:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8001ce:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8001d5:	00 00 00 
	b.cnt = 0;
  8001d8:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8001df:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8001e2:	ff 75 0c             	pushl  0xc(%ebp)
  8001e5:	ff 75 08             	pushl  0x8(%ebp)
  8001e8:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001ee:	50                   	push   %eax
  8001ef:	68 79 01 80 00       	push   $0x800179
  8001f4:	e8 20 01 00 00       	call   800319 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001f9:	83 c4 08             	add    $0x8,%esp
  8001fc:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800202:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800208:	50                   	push   %eax
  800209:	e8 53 09 00 00       	call   800b61 <sys_cputs>

	return b.cnt;
}
  80020e:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800214:	c9                   	leave  
  800215:	c3                   	ret    

00800216 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800216:	f3 0f 1e fb          	endbr32 
  80021a:	55                   	push   %ebp
  80021b:	89 e5                	mov    %esp,%ebp
  80021d:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800220:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800223:	50                   	push   %eax
  800224:	ff 75 08             	pushl  0x8(%ebp)
  800227:	e8 95 ff ff ff       	call   8001c1 <vcprintf>
	va_end(ap);

	return cnt;
}
  80022c:	c9                   	leave  
  80022d:	c3                   	ret    

0080022e <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80022e:	55                   	push   %ebp
  80022f:	89 e5                	mov    %esp,%ebp
  800231:	57                   	push   %edi
  800232:	56                   	push   %esi
  800233:	53                   	push   %ebx
  800234:	83 ec 1c             	sub    $0x1c,%esp
  800237:	89 c7                	mov    %eax,%edi
  800239:	89 d6                	mov    %edx,%esi
  80023b:	8b 45 08             	mov    0x8(%ebp),%eax
  80023e:	8b 55 0c             	mov    0xc(%ebp),%edx
  800241:	89 d1                	mov    %edx,%ecx
  800243:	89 c2                	mov    %eax,%edx
  800245:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800248:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80024b:	8b 45 10             	mov    0x10(%ebp),%eax
  80024e:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800251:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800254:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80025b:	39 c2                	cmp    %eax,%edx
  80025d:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800260:	72 3e                	jb     8002a0 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800262:	83 ec 0c             	sub    $0xc,%esp
  800265:	ff 75 18             	pushl  0x18(%ebp)
  800268:	83 eb 01             	sub    $0x1,%ebx
  80026b:	53                   	push   %ebx
  80026c:	50                   	push   %eax
  80026d:	83 ec 08             	sub    $0x8,%esp
  800270:	ff 75 e4             	pushl  -0x1c(%ebp)
  800273:	ff 75 e0             	pushl  -0x20(%ebp)
  800276:	ff 75 dc             	pushl  -0x24(%ebp)
  800279:	ff 75 d8             	pushl  -0x28(%ebp)
  80027c:	e8 ff 1a 00 00       	call   801d80 <__udivdi3>
  800281:	83 c4 18             	add    $0x18,%esp
  800284:	52                   	push   %edx
  800285:	50                   	push   %eax
  800286:	89 f2                	mov    %esi,%edx
  800288:	89 f8                	mov    %edi,%eax
  80028a:	e8 9f ff ff ff       	call   80022e <printnum>
  80028f:	83 c4 20             	add    $0x20,%esp
  800292:	eb 13                	jmp    8002a7 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800294:	83 ec 08             	sub    $0x8,%esp
  800297:	56                   	push   %esi
  800298:	ff 75 18             	pushl  0x18(%ebp)
  80029b:	ff d7                	call   *%edi
  80029d:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8002a0:	83 eb 01             	sub    $0x1,%ebx
  8002a3:	85 db                	test   %ebx,%ebx
  8002a5:	7f ed                	jg     800294 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8002a7:	83 ec 08             	sub    $0x8,%esp
  8002aa:	56                   	push   %esi
  8002ab:	83 ec 04             	sub    $0x4,%esp
  8002ae:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002b1:	ff 75 e0             	pushl  -0x20(%ebp)
  8002b4:	ff 75 dc             	pushl  -0x24(%ebp)
  8002b7:	ff 75 d8             	pushl  -0x28(%ebp)
  8002ba:	e8 d1 1b 00 00       	call   801e90 <__umoddi3>
  8002bf:	83 c4 14             	add    $0x14,%esp
  8002c2:	0f be 80 7b 20 80 00 	movsbl 0x80207b(%eax),%eax
  8002c9:	50                   	push   %eax
  8002ca:	ff d7                	call   *%edi
}
  8002cc:	83 c4 10             	add    $0x10,%esp
  8002cf:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8002d2:	5b                   	pop    %ebx
  8002d3:	5e                   	pop    %esi
  8002d4:	5f                   	pop    %edi
  8002d5:	5d                   	pop    %ebp
  8002d6:	c3                   	ret    

008002d7 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8002d7:	f3 0f 1e fb          	endbr32 
  8002db:	55                   	push   %ebp
  8002dc:	89 e5                	mov    %esp,%ebp
  8002de:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002e1:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002e5:	8b 10                	mov    (%eax),%edx
  8002e7:	3b 50 04             	cmp    0x4(%eax),%edx
  8002ea:	73 0a                	jae    8002f6 <sprintputch+0x1f>
		*b->buf++ = ch;
  8002ec:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002ef:	89 08                	mov    %ecx,(%eax)
  8002f1:	8b 45 08             	mov    0x8(%ebp),%eax
  8002f4:	88 02                	mov    %al,(%edx)
}
  8002f6:	5d                   	pop    %ebp
  8002f7:	c3                   	ret    

008002f8 <printfmt>:
{
  8002f8:	f3 0f 1e fb          	endbr32 
  8002fc:	55                   	push   %ebp
  8002fd:	89 e5                	mov    %esp,%ebp
  8002ff:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800302:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800305:	50                   	push   %eax
  800306:	ff 75 10             	pushl  0x10(%ebp)
  800309:	ff 75 0c             	pushl  0xc(%ebp)
  80030c:	ff 75 08             	pushl  0x8(%ebp)
  80030f:	e8 05 00 00 00       	call   800319 <vprintfmt>
}
  800314:	83 c4 10             	add    $0x10,%esp
  800317:	c9                   	leave  
  800318:	c3                   	ret    

00800319 <vprintfmt>:
{
  800319:	f3 0f 1e fb          	endbr32 
  80031d:	55                   	push   %ebp
  80031e:	89 e5                	mov    %esp,%ebp
  800320:	57                   	push   %edi
  800321:	56                   	push   %esi
  800322:	53                   	push   %ebx
  800323:	83 ec 3c             	sub    $0x3c,%esp
  800326:	8b 75 08             	mov    0x8(%ebp),%esi
  800329:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80032c:	8b 7d 10             	mov    0x10(%ebp),%edi
  80032f:	e9 5d 03 00 00       	jmp    800691 <vprintfmt+0x378>
		padc = ' ';
  800334:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800338:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  80033f:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800346:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80034d:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800352:	8d 47 01             	lea    0x1(%edi),%eax
  800355:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800358:	0f b6 17             	movzbl (%edi),%edx
  80035b:	8d 42 dd             	lea    -0x23(%edx),%eax
  80035e:	3c 55                	cmp    $0x55,%al
  800360:	0f 87 ae 03 00 00    	ja     800714 <vprintfmt+0x3fb>
  800366:	0f b6 c0             	movzbl %al,%eax
  800369:	3e ff 24 85 c0 21 80 	notrack jmp *0x8021c0(,%eax,4)
  800370:	00 
  800371:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800374:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800378:	eb d8                	jmp    800352 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80037a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80037d:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800381:	eb cf                	jmp    800352 <vprintfmt+0x39>
  800383:	0f b6 d2             	movzbl %dl,%edx
  800386:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800389:	b8 00 00 00 00       	mov    $0x0,%eax
  80038e:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800391:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800394:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800398:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80039b:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80039e:	83 f9 09             	cmp    $0x9,%ecx
  8003a1:	77 55                	ja     8003f8 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8003a3:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8003a6:	eb e9                	jmp    800391 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8003a8:	8b 45 14             	mov    0x14(%ebp),%eax
  8003ab:	8b 00                	mov    (%eax),%eax
  8003ad:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003b0:	8b 45 14             	mov    0x14(%ebp),%eax
  8003b3:	8d 40 04             	lea    0x4(%eax),%eax
  8003b6:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003b9:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003bc:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8003c0:	79 90                	jns    800352 <vprintfmt+0x39>
				width = precision, precision = -1;
  8003c2:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8003c5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8003c8:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8003cf:	eb 81                	jmp    800352 <vprintfmt+0x39>
  8003d1:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8003d4:	85 c0                	test   %eax,%eax
  8003d6:	ba 00 00 00 00       	mov    $0x0,%edx
  8003db:	0f 49 d0             	cmovns %eax,%edx
  8003de:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003e1:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003e4:	e9 69 ff ff ff       	jmp    800352 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003e9:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003ec:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003f3:	e9 5a ff ff ff       	jmp    800352 <vprintfmt+0x39>
  8003f8:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003fb:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003fe:	eb bc                	jmp    8003bc <vprintfmt+0xa3>
			lflag++;
  800400:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800403:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800406:	e9 47 ff ff ff       	jmp    800352 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80040b:	8b 45 14             	mov    0x14(%ebp),%eax
  80040e:	8d 78 04             	lea    0x4(%eax),%edi
  800411:	83 ec 08             	sub    $0x8,%esp
  800414:	53                   	push   %ebx
  800415:	ff 30                	pushl  (%eax)
  800417:	ff d6                	call   *%esi
			break;
  800419:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80041c:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  80041f:	e9 6a 02 00 00       	jmp    80068e <vprintfmt+0x375>
			err = va_arg(ap, int);
  800424:	8b 45 14             	mov    0x14(%ebp),%eax
  800427:	8d 78 04             	lea    0x4(%eax),%edi
  80042a:	8b 00                	mov    (%eax),%eax
  80042c:	99                   	cltd   
  80042d:	31 d0                	xor    %edx,%eax
  80042f:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800431:	83 f8 0f             	cmp    $0xf,%eax
  800434:	7f 23                	jg     800459 <vprintfmt+0x140>
  800436:	8b 14 85 20 23 80 00 	mov    0x802320(,%eax,4),%edx
  80043d:	85 d2                	test   %edx,%edx
  80043f:	74 18                	je     800459 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800441:	52                   	push   %edx
  800442:	68 c1 24 80 00       	push   $0x8024c1
  800447:	53                   	push   %ebx
  800448:	56                   	push   %esi
  800449:	e8 aa fe ff ff       	call   8002f8 <printfmt>
  80044e:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800451:	89 7d 14             	mov    %edi,0x14(%ebp)
  800454:	e9 35 02 00 00       	jmp    80068e <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800459:	50                   	push   %eax
  80045a:	68 93 20 80 00       	push   $0x802093
  80045f:	53                   	push   %ebx
  800460:	56                   	push   %esi
  800461:	e8 92 fe ff ff       	call   8002f8 <printfmt>
  800466:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800469:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80046c:	e9 1d 02 00 00       	jmp    80068e <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800471:	8b 45 14             	mov    0x14(%ebp),%eax
  800474:	83 c0 04             	add    $0x4,%eax
  800477:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80047a:	8b 45 14             	mov    0x14(%ebp),%eax
  80047d:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  80047f:	85 d2                	test   %edx,%edx
  800481:	b8 8c 20 80 00       	mov    $0x80208c,%eax
  800486:	0f 45 c2             	cmovne %edx,%eax
  800489:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80048c:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800490:	7e 06                	jle    800498 <vprintfmt+0x17f>
  800492:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800496:	75 0d                	jne    8004a5 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800498:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80049b:	89 c7                	mov    %eax,%edi
  80049d:	03 45 d4             	add    -0x2c(%ebp),%eax
  8004a0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004a3:	eb 55                	jmp    8004fa <vprintfmt+0x1e1>
  8004a5:	83 ec 08             	sub    $0x8,%esp
  8004a8:	ff 75 d8             	pushl  -0x28(%ebp)
  8004ab:	ff 75 cc             	pushl  -0x34(%ebp)
  8004ae:	e8 15 03 00 00       	call   8007c8 <strnlen>
  8004b3:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8004b6:	29 c2                	sub    %eax,%edx
  8004b8:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004bb:	83 c4 10             	add    $0x10,%esp
  8004be:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8004c0:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8004c4:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8004c7:	85 ff                	test   %edi,%edi
  8004c9:	7e 11                	jle    8004dc <vprintfmt+0x1c3>
					putch(padc, putdat);
  8004cb:	83 ec 08             	sub    $0x8,%esp
  8004ce:	53                   	push   %ebx
  8004cf:	ff 75 d4             	pushl  -0x2c(%ebp)
  8004d2:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8004d4:	83 ef 01             	sub    $0x1,%edi
  8004d7:	83 c4 10             	add    $0x10,%esp
  8004da:	eb eb                	jmp    8004c7 <vprintfmt+0x1ae>
  8004dc:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004df:	85 d2                	test   %edx,%edx
  8004e1:	b8 00 00 00 00       	mov    $0x0,%eax
  8004e6:	0f 49 c2             	cmovns %edx,%eax
  8004e9:	29 c2                	sub    %eax,%edx
  8004eb:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004ee:	eb a8                	jmp    800498 <vprintfmt+0x17f>
					putch(ch, putdat);
  8004f0:	83 ec 08             	sub    $0x8,%esp
  8004f3:	53                   	push   %ebx
  8004f4:	52                   	push   %edx
  8004f5:	ff d6                	call   *%esi
  8004f7:	83 c4 10             	add    $0x10,%esp
  8004fa:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004fd:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004ff:	83 c7 01             	add    $0x1,%edi
  800502:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800506:	0f be d0             	movsbl %al,%edx
  800509:	85 d2                	test   %edx,%edx
  80050b:	74 4b                	je     800558 <vprintfmt+0x23f>
  80050d:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800511:	78 06                	js     800519 <vprintfmt+0x200>
  800513:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800517:	78 1e                	js     800537 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800519:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80051d:	74 d1                	je     8004f0 <vprintfmt+0x1d7>
  80051f:	0f be c0             	movsbl %al,%eax
  800522:	83 e8 20             	sub    $0x20,%eax
  800525:	83 f8 5e             	cmp    $0x5e,%eax
  800528:	76 c6                	jbe    8004f0 <vprintfmt+0x1d7>
					putch('?', putdat);
  80052a:	83 ec 08             	sub    $0x8,%esp
  80052d:	53                   	push   %ebx
  80052e:	6a 3f                	push   $0x3f
  800530:	ff d6                	call   *%esi
  800532:	83 c4 10             	add    $0x10,%esp
  800535:	eb c3                	jmp    8004fa <vprintfmt+0x1e1>
  800537:	89 cf                	mov    %ecx,%edi
  800539:	eb 0e                	jmp    800549 <vprintfmt+0x230>
				putch(' ', putdat);
  80053b:	83 ec 08             	sub    $0x8,%esp
  80053e:	53                   	push   %ebx
  80053f:	6a 20                	push   $0x20
  800541:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800543:	83 ef 01             	sub    $0x1,%edi
  800546:	83 c4 10             	add    $0x10,%esp
  800549:	85 ff                	test   %edi,%edi
  80054b:	7f ee                	jg     80053b <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80054d:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800550:	89 45 14             	mov    %eax,0x14(%ebp)
  800553:	e9 36 01 00 00       	jmp    80068e <vprintfmt+0x375>
  800558:	89 cf                	mov    %ecx,%edi
  80055a:	eb ed                	jmp    800549 <vprintfmt+0x230>
	if (lflag >= 2)
  80055c:	83 f9 01             	cmp    $0x1,%ecx
  80055f:	7f 1f                	jg     800580 <vprintfmt+0x267>
	else if (lflag)
  800561:	85 c9                	test   %ecx,%ecx
  800563:	74 67                	je     8005cc <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800565:	8b 45 14             	mov    0x14(%ebp),%eax
  800568:	8b 00                	mov    (%eax),%eax
  80056a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80056d:	89 c1                	mov    %eax,%ecx
  80056f:	c1 f9 1f             	sar    $0x1f,%ecx
  800572:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800575:	8b 45 14             	mov    0x14(%ebp),%eax
  800578:	8d 40 04             	lea    0x4(%eax),%eax
  80057b:	89 45 14             	mov    %eax,0x14(%ebp)
  80057e:	eb 17                	jmp    800597 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800580:	8b 45 14             	mov    0x14(%ebp),%eax
  800583:	8b 50 04             	mov    0x4(%eax),%edx
  800586:	8b 00                	mov    (%eax),%eax
  800588:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80058b:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80058e:	8b 45 14             	mov    0x14(%ebp),%eax
  800591:	8d 40 08             	lea    0x8(%eax),%eax
  800594:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800597:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80059a:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80059d:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005a2:	85 c9                	test   %ecx,%ecx
  8005a4:	0f 89 ca 00 00 00    	jns    800674 <vprintfmt+0x35b>
				putch('-', putdat);
  8005aa:	83 ec 08             	sub    $0x8,%esp
  8005ad:	53                   	push   %ebx
  8005ae:	6a 2d                	push   $0x2d
  8005b0:	ff d6                	call   *%esi
				num = -(long long) num;
  8005b2:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005b5:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005b8:	f7 da                	neg    %edx
  8005ba:	83 d1 00             	adc    $0x0,%ecx
  8005bd:	f7 d9                	neg    %ecx
  8005bf:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8005c2:	b8 0a 00 00 00       	mov    $0xa,%eax
  8005c7:	e9 a8 00 00 00       	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8005cc:	8b 45 14             	mov    0x14(%ebp),%eax
  8005cf:	8b 00                	mov    (%eax),%eax
  8005d1:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005d4:	99                   	cltd   
  8005d5:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005d8:	8b 45 14             	mov    0x14(%ebp),%eax
  8005db:	8d 40 04             	lea    0x4(%eax),%eax
  8005de:	89 45 14             	mov    %eax,0x14(%ebp)
  8005e1:	eb b4                	jmp    800597 <vprintfmt+0x27e>
	if (lflag >= 2)
  8005e3:	83 f9 01             	cmp    $0x1,%ecx
  8005e6:	7f 1b                	jg     800603 <vprintfmt+0x2ea>
	else if (lflag)
  8005e8:	85 c9                	test   %ecx,%ecx
  8005ea:	74 2c                	je     800618 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005ec:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ef:	8b 10                	mov    (%eax),%edx
  8005f1:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005f6:	8d 40 04             	lea    0x4(%eax),%eax
  8005f9:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005fc:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800601:	eb 71                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800603:	8b 45 14             	mov    0x14(%ebp),%eax
  800606:	8b 10                	mov    (%eax),%edx
  800608:	8b 48 04             	mov    0x4(%eax),%ecx
  80060b:	8d 40 08             	lea    0x8(%eax),%eax
  80060e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800611:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800616:	eb 5c                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800618:	8b 45 14             	mov    0x14(%ebp),%eax
  80061b:	8b 10                	mov    (%eax),%edx
  80061d:	b9 00 00 00 00       	mov    $0x0,%ecx
  800622:	8d 40 04             	lea    0x4(%eax),%eax
  800625:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800628:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80062d:	eb 45                	jmp    800674 <vprintfmt+0x35b>
			putch('X', putdat);
  80062f:	83 ec 08             	sub    $0x8,%esp
  800632:	53                   	push   %ebx
  800633:	6a 58                	push   $0x58
  800635:	ff d6                	call   *%esi
			putch('X', putdat);
  800637:	83 c4 08             	add    $0x8,%esp
  80063a:	53                   	push   %ebx
  80063b:	6a 58                	push   $0x58
  80063d:	ff d6                	call   *%esi
			putch('X', putdat);
  80063f:	83 c4 08             	add    $0x8,%esp
  800642:	53                   	push   %ebx
  800643:	6a 58                	push   $0x58
  800645:	ff d6                	call   *%esi
			break;
  800647:	83 c4 10             	add    $0x10,%esp
  80064a:	eb 42                	jmp    80068e <vprintfmt+0x375>
			putch('0', putdat);
  80064c:	83 ec 08             	sub    $0x8,%esp
  80064f:	53                   	push   %ebx
  800650:	6a 30                	push   $0x30
  800652:	ff d6                	call   *%esi
			putch('x', putdat);
  800654:	83 c4 08             	add    $0x8,%esp
  800657:	53                   	push   %ebx
  800658:	6a 78                	push   $0x78
  80065a:	ff d6                	call   *%esi
			num = (unsigned long long)
  80065c:	8b 45 14             	mov    0x14(%ebp),%eax
  80065f:	8b 10                	mov    (%eax),%edx
  800661:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800666:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800669:	8d 40 04             	lea    0x4(%eax),%eax
  80066c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80066f:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800674:	83 ec 0c             	sub    $0xc,%esp
  800677:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80067b:	57                   	push   %edi
  80067c:	ff 75 d4             	pushl  -0x2c(%ebp)
  80067f:	50                   	push   %eax
  800680:	51                   	push   %ecx
  800681:	52                   	push   %edx
  800682:	89 da                	mov    %ebx,%edx
  800684:	89 f0                	mov    %esi,%eax
  800686:	e8 a3 fb ff ff       	call   80022e <printnum>
			break;
  80068b:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80068e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800691:	83 c7 01             	add    $0x1,%edi
  800694:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800698:	83 f8 25             	cmp    $0x25,%eax
  80069b:	0f 84 93 fc ff ff    	je     800334 <vprintfmt+0x1b>
			if (ch == '\0')
  8006a1:	85 c0                	test   %eax,%eax
  8006a3:	0f 84 8b 00 00 00    	je     800734 <vprintfmt+0x41b>
			putch(ch, putdat);
  8006a9:	83 ec 08             	sub    $0x8,%esp
  8006ac:	53                   	push   %ebx
  8006ad:	50                   	push   %eax
  8006ae:	ff d6                	call   *%esi
  8006b0:	83 c4 10             	add    $0x10,%esp
  8006b3:	eb dc                	jmp    800691 <vprintfmt+0x378>
	if (lflag >= 2)
  8006b5:	83 f9 01             	cmp    $0x1,%ecx
  8006b8:	7f 1b                	jg     8006d5 <vprintfmt+0x3bc>
	else if (lflag)
  8006ba:	85 c9                	test   %ecx,%ecx
  8006bc:	74 2c                	je     8006ea <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006be:	8b 45 14             	mov    0x14(%ebp),%eax
  8006c1:	8b 10                	mov    (%eax),%edx
  8006c3:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006c8:	8d 40 04             	lea    0x4(%eax),%eax
  8006cb:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006ce:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8006d3:	eb 9f                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006d5:	8b 45 14             	mov    0x14(%ebp),%eax
  8006d8:	8b 10                	mov    (%eax),%edx
  8006da:	8b 48 04             	mov    0x4(%eax),%ecx
  8006dd:	8d 40 08             	lea    0x8(%eax),%eax
  8006e0:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006e3:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006e8:	eb 8a                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006ea:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ed:	8b 10                	mov    (%eax),%edx
  8006ef:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006f4:	8d 40 04             	lea    0x4(%eax),%eax
  8006f7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006fa:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006ff:	e9 70 ff ff ff       	jmp    800674 <vprintfmt+0x35b>
			putch(ch, putdat);
  800704:	83 ec 08             	sub    $0x8,%esp
  800707:	53                   	push   %ebx
  800708:	6a 25                	push   $0x25
  80070a:	ff d6                	call   *%esi
			break;
  80070c:	83 c4 10             	add    $0x10,%esp
  80070f:	e9 7a ff ff ff       	jmp    80068e <vprintfmt+0x375>
			putch('%', putdat);
  800714:	83 ec 08             	sub    $0x8,%esp
  800717:	53                   	push   %ebx
  800718:	6a 25                	push   $0x25
  80071a:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80071c:	83 c4 10             	add    $0x10,%esp
  80071f:	89 f8                	mov    %edi,%eax
  800721:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800725:	74 05                	je     80072c <vprintfmt+0x413>
  800727:	83 e8 01             	sub    $0x1,%eax
  80072a:	eb f5                	jmp    800721 <vprintfmt+0x408>
  80072c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80072f:	e9 5a ff ff ff       	jmp    80068e <vprintfmt+0x375>
}
  800734:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800737:	5b                   	pop    %ebx
  800738:	5e                   	pop    %esi
  800739:	5f                   	pop    %edi
  80073a:	5d                   	pop    %ebp
  80073b:	c3                   	ret    

0080073c <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80073c:	f3 0f 1e fb          	endbr32 
  800740:	55                   	push   %ebp
  800741:	89 e5                	mov    %esp,%ebp
  800743:	83 ec 18             	sub    $0x18,%esp
  800746:	8b 45 08             	mov    0x8(%ebp),%eax
  800749:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80074c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  80074f:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800753:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800756:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80075d:	85 c0                	test   %eax,%eax
  80075f:	74 26                	je     800787 <vsnprintf+0x4b>
  800761:	85 d2                	test   %edx,%edx
  800763:	7e 22                	jle    800787 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800765:	ff 75 14             	pushl  0x14(%ebp)
  800768:	ff 75 10             	pushl  0x10(%ebp)
  80076b:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80076e:	50                   	push   %eax
  80076f:	68 d7 02 80 00       	push   $0x8002d7
  800774:	e8 a0 fb ff ff       	call   800319 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800779:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80077c:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  80077f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800782:	83 c4 10             	add    $0x10,%esp
}
  800785:	c9                   	leave  
  800786:	c3                   	ret    
		return -E_INVAL;
  800787:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80078c:	eb f7                	jmp    800785 <vsnprintf+0x49>

0080078e <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80078e:	f3 0f 1e fb          	endbr32 
  800792:	55                   	push   %ebp
  800793:	89 e5                	mov    %esp,%ebp
  800795:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800798:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80079b:	50                   	push   %eax
  80079c:	ff 75 10             	pushl  0x10(%ebp)
  80079f:	ff 75 0c             	pushl  0xc(%ebp)
  8007a2:	ff 75 08             	pushl  0x8(%ebp)
  8007a5:	e8 92 ff ff ff       	call   80073c <vsnprintf>
	va_end(ap);

	return rc;
}
  8007aa:	c9                   	leave  
  8007ab:	c3                   	ret    

008007ac <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007ac:	f3 0f 1e fb          	endbr32 
  8007b0:	55                   	push   %ebp
  8007b1:	89 e5                	mov    %esp,%ebp
  8007b3:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007b6:	b8 00 00 00 00       	mov    $0x0,%eax
  8007bb:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007bf:	74 05                	je     8007c6 <strlen+0x1a>
		n++;
  8007c1:	83 c0 01             	add    $0x1,%eax
  8007c4:	eb f5                	jmp    8007bb <strlen+0xf>
	return n;
}
  8007c6:	5d                   	pop    %ebp
  8007c7:	c3                   	ret    

008007c8 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007c8:	f3 0f 1e fb          	endbr32 
  8007cc:	55                   	push   %ebp
  8007cd:	89 e5                	mov    %esp,%ebp
  8007cf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007d2:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007d5:	b8 00 00 00 00       	mov    $0x0,%eax
  8007da:	39 d0                	cmp    %edx,%eax
  8007dc:	74 0d                	je     8007eb <strnlen+0x23>
  8007de:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8007e2:	74 05                	je     8007e9 <strnlen+0x21>
		n++;
  8007e4:	83 c0 01             	add    $0x1,%eax
  8007e7:	eb f1                	jmp    8007da <strnlen+0x12>
  8007e9:	89 c2                	mov    %eax,%edx
	return n;
}
  8007eb:	89 d0                	mov    %edx,%eax
  8007ed:	5d                   	pop    %ebp
  8007ee:	c3                   	ret    

008007ef <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007ef:	f3 0f 1e fb          	endbr32 
  8007f3:	55                   	push   %ebp
  8007f4:	89 e5                	mov    %esp,%ebp
  8007f6:	53                   	push   %ebx
  8007f7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007fa:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007fd:	b8 00 00 00 00       	mov    $0x0,%eax
  800802:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800806:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800809:	83 c0 01             	add    $0x1,%eax
  80080c:	84 d2                	test   %dl,%dl
  80080e:	75 f2                	jne    800802 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800810:	89 c8                	mov    %ecx,%eax
  800812:	5b                   	pop    %ebx
  800813:	5d                   	pop    %ebp
  800814:	c3                   	ret    

00800815 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800815:	f3 0f 1e fb          	endbr32 
  800819:	55                   	push   %ebp
  80081a:	89 e5                	mov    %esp,%ebp
  80081c:	53                   	push   %ebx
  80081d:	83 ec 10             	sub    $0x10,%esp
  800820:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800823:	53                   	push   %ebx
  800824:	e8 83 ff ff ff       	call   8007ac <strlen>
  800829:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80082c:	ff 75 0c             	pushl  0xc(%ebp)
  80082f:	01 d8                	add    %ebx,%eax
  800831:	50                   	push   %eax
  800832:	e8 b8 ff ff ff       	call   8007ef <strcpy>
	return dst;
}
  800837:	89 d8                	mov    %ebx,%eax
  800839:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80083c:	c9                   	leave  
  80083d:	c3                   	ret    

0080083e <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80083e:	f3 0f 1e fb          	endbr32 
  800842:	55                   	push   %ebp
  800843:	89 e5                	mov    %esp,%ebp
  800845:	56                   	push   %esi
  800846:	53                   	push   %ebx
  800847:	8b 75 08             	mov    0x8(%ebp),%esi
  80084a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80084d:	89 f3                	mov    %esi,%ebx
  80084f:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800852:	89 f0                	mov    %esi,%eax
  800854:	39 d8                	cmp    %ebx,%eax
  800856:	74 11                	je     800869 <strncpy+0x2b>
		*dst++ = *src;
  800858:	83 c0 01             	add    $0x1,%eax
  80085b:	0f b6 0a             	movzbl (%edx),%ecx
  80085e:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800861:	80 f9 01             	cmp    $0x1,%cl
  800864:	83 da ff             	sbb    $0xffffffff,%edx
  800867:	eb eb                	jmp    800854 <strncpy+0x16>
	}
	return ret;
}
  800869:	89 f0                	mov    %esi,%eax
  80086b:	5b                   	pop    %ebx
  80086c:	5e                   	pop    %esi
  80086d:	5d                   	pop    %ebp
  80086e:	c3                   	ret    

0080086f <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  80086f:	f3 0f 1e fb          	endbr32 
  800873:	55                   	push   %ebp
  800874:	89 e5                	mov    %esp,%ebp
  800876:	56                   	push   %esi
  800877:	53                   	push   %ebx
  800878:	8b 75 08             	mov    0x8(%ebp),%esi
  80087b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80087e:	8b 55 10             	mov    0x10(%ebp),%edx
  800881:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800883:	85 d2                	test   %edx,%edx
  800885:	74 21                	je     8008a8 <strlcpy+0x39>
  800887:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80088b:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80088d:	39 c2                	cmp    %eax,%edx
  80088f:	74 14                	je     8008a5 <strlcpy+0x36>
  800891:	0f b6 19             	movzbl (%ecx),%ebx
  800894:	84 db                	test   %bl,%bl
  800896:	74 0b                	je     8008a3 <strlcpy+0x34>
			*dst++ = *src++;
  800898:	83 c1 01             	add    $0x1,%ecx
  80089b:	83 c2 01             	add    $0x1,%edx
  80089e:	88 5a ff             	mov    %bl,-0x1(%edx)
  8008a1:	eb ea                	jmp    80088d <strlcpy+0x1e>
  8008a3:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8008a5:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8008a8:	29 f0                	sub    %esi,%eax
}
  8008aa:	5b                   	pop    %ebx
  8008ab:	5e                   	pop    %esi
  8008ac:	5d                   	pop    %ebp
  8008ad:	c3                   	ret    

008008ae <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8008ae:	f3 0f 1e fb          	endbr32 
  8008b2:	55                   	push   %ebp
  8008b3:	89 e5                	mov    %esp,%ebp
  8008b5:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008b8:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008bb:	0f b6 01             	movzbl (%ecx),%eax
  8008be:	84 c0                	test   %al,%al
  8008c0:	74 0c                	je     8008ce <strcmp+0x20>
  8008c2:	3a 02                	cmp    (%edx),%al
  8008c4:	75 08                	jne    8008ce <strcmp+0x20>
		p++, q++;
  8008c6:	83 c1 01             	add    $0x1,%ecx
  8008c9:	83 c2 01             	add    $0x1,%edx
  8008cc:	eb ed                	jmp    8008bb <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8008ce:	0f b6 c0             	movzbl %al,%eax
  8008d1:	0f b6 12             	movzbl (%edx),%edx
  8008d4:	29 d0                	sub    %edx,%eax
}
  8008d6:	5d                   	pop    %ebp
  8008d7:	c3                   	ret    

008008d8 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8008d8:	f3 0f 1e fb          	endbr32 
  8008dc:	55                   	push   %ebp
  8008dd:	89 e5                	mov    %esp,%ebp
  8008df:	53                   	push   %ebx
  8008e0:	8b 45 08             	mov    0x8(%ebp),%eax
  8008e3:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008e6:	89 c3                	mov    %eax,%ebx
  8008e8:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008eb:	eb 06                	jmp    8008f3 <strncmp+0x1b>
		n--, p++, q++;
  8008ed:	83 c0 01             	add    $0x1,%eax
  8008f0:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008f3:	39 d8                	cmp    %ebx,%eax
  8008f5:	74 16                	je     80090d <strncmp+0x35>
  8008f7:	0f b6 08             	movzbl (%eax),%ecx
  8008fa:	84 c9                	test   %cl,%cl
  8008fc:	74 04                	je     800902 <strncmp+0x2a>
  8008fe:	3a 0a                	cmp    (%edx),%cl
  800900:	74 eb                	je     8008ed <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800902:	0f b6 00             	movzbl (%eax),%eax
  800905:	0f b6 12             	movzbl (%edx),%edx
  800908:	29 d0                	sub    %edx,%eax
}
  80090a:	5b                   	pop    %ebx
  80090b:	5d                   	pop    %ebp
  80090c:	c3                   	ret    
		return 0;
  80090d:	b8 00 00 00 00       	mov    $0x0,%eax
  800912:	eb f6                	jmp    80090a <strncmp+0x32>

00800914 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800914:	f3 0f 1e fb          	endbr32 
  800918:	55                   	push   %ebp
  800919:	89 e5                	mov    %esp,%ebp
  80091b:	8b 45 08             	mov    0x8(%ebp),%eax
  80091e:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800922:	0f b6 10             	movzbl (%eax),%edx
  800925:	84 d2                	test   %dl,%dl
  800927:	74 09                	je     800932 <strchr+0x1e>
		if (*s == c)
  800929:	38 ca                	cmp    %cl,%dl
  80092b:	74 0a                	je     800937 <strchr+0x23>
	for (; *s; s++)
  80092d:	83 c0 01             	add    $0x1,%eax
  800930:	eb f0                	jmp    800922 <strchr+0xe>
			return (char *) s;
	return 0;
  800932:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800937:	5d                   	pop    %ebp
  800938:	c3                   	ret    

00800939 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800939:	f3 0f 1e fb          	endbr32 
  80093d:	55                   	push   %ebp
  80093e:	89 e5                	mov    %esp,%ebp
  800940:	8b 45 08             	mov    0x8(%ebp),%eax
  800943:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800947:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  80094a:	38 ca                	cmp    %cl,%dl
  80094c:	74 09                	je     800957 <strfind+0x1e>
  80094e:	84 d2                	test   %dl,%dl
  800950:	74 05                	je     800957 <strfind+0x1e>
	for (; *s; s++)
  800952:	83 c0 01             	add    $0x1,%eax
  800955:	eb f0                	jmp    800947 <strfind+0xe>
			break;
	return (char *) s;
}
  800957:	5d                   	pop    %ebp
  800958:	c3                   	ret    

00800959 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800959:	f3 0f 1e fb          	endbr32 
  80095d:	55                   	push   %ebp
  80095e:	89 e5                	mov    %esp,%ebp
  800960:	57                   	push   %edi
  800961:	56                   	push   %esi
  800962:	53                   	push   %ebx
  800963:	8b 7d 08             	mov    0x8(%ebp),%edi
  800966:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800969:	85 c9                	test   %ecx,%ecx
  80096b:	74 31                	je     80099e <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80096d:	89 f8                	mov    %edi,%eax
  80096f:	09 c8                	or     %ecx,%eax
  800971:	a8 03                	test   $0x3,%al
  800973:	75 23                	jne    800998 <memset+0x3f>
		c &= 0xFF;
  800975:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800979:	89 d3                	mov    %edx,%ebx
  80097b:	c1 e3 08             	shl    $0x8,%ebx
  80097e:	89 d0                	mov    %edx,%eax
  800980:	c1 e0 18             	shl    $0x18,%eax
  800983:	89 d6                	mov    %edx,%esi
  800985:	c1 e6 10             	shl    $0x10,%esi
  800988:	09 f0                	or     %esi,%eax
  80098a:	09 c2                	or     %eax,%edx
  80098c:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  80098e:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800991:	89 d0                	mov    %edx,%eax
  800993:	fc                   	cld    
  800994:	f3 ab                	rep stos %eax,%es:(%edi)
  800996:	eb 06                	jmp    80099e <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800998:	8b 45 0c             	mov    0xc(%ebp),%eax
  80099b:	fc                   	cld    
  80099c:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  80099e:	89 f8                	mov    %edi,%eax
  8009a0:	5b                   	pop    %ebx
  8009a1:	5e                   	pop    %esi
  8009a2:	5f                   	pop    %edi
  8009a3:	5d                   	pop    %ebp
  8009a4:	c3                   	ret    

008009a5 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009a5:	f3 0f 1e fb          	endbr32 
  8009a9:	55                   	push   %ebp
  8009aa:	89 e5                	mov    %esp,%ebp
  8009ac:	57                   	push   %edi
  8009ad:	56                   	push   %esi
  8009ae:	8b 45 08             	mov    0x8(%ebp),%eax
  8009b1:	8b 75 0c             	mov    0xc(%ebp),%esi
  8009b4:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  8009b7:	39 c6                	cmp    %eax,%esi
  8009b9:	73 32                	jae    8009ed <memmove+0x48>
  8009bb:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009be:	39 c2                	cmp    %eax,%edx
  8009c0:	76 2b                	jbe    8009ed <memmove+0x48>
		s += n;
		d += n;
  8009c2:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009c5:	89 fe                	mov    %edi,%esi
  8009c7:	09 ce                	or     %ecx,%esi
  8009c9:	09 d6                	or     %edx,%esi
  8009cb:	f7 c6 03 00 00 00    	test   $0x3,%esi
  8009d1:	75 0e                	jne    8009e1 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  8009d3:	83 ef 04             	sub    $0x4,%edi
  8009d6:	8d 72 fc             	lea    -0x4(%edx),%esi
  8009d9:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  8009dc:	fd                   	std    
  8009dd:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009df:	eb 09                	jmp    8009ea <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  8009e1:	83 ef 01             	sub    $0x1,%edi
  8009e4:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009e7:	fd                   	std    
  8009e8:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009ea:	fc                   	cld    
  8009eb:	eb 1a                	jmp    800a07 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009ed:	89 c2                	mov    %eax,%edx
  8009ef:	09 ca                	or     %ecx,%edx
  8009f1:	09 f2                	or     %esi,%edx
  8009f3:	f6 c2 03             	test   $0x3,%dl
  8009f6:	75 0a                	jne    800a02 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009f8:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009fb:	89 c7                	mov    %eax,%edi
  8009fd:	fc                   	cld    
  8009fe:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a00:	eb 05                	jmp    800a07 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800a02:	89 c7                	mov    %eax,%edi
  800a04:	fc                   	cld    
  800a05:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a07:	5e                   	pop    %esi
  800a08:	5f                   	pop    %edi
  800a09:	5d                   	pop    %ebp
  800a0a:	c3                   	ret    

00800a0b <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800a0b:	f3 0f 1e fb          	endbr32 
  800a0f:	55                   	push   %ebp
  800a10:	89 e5                	mov    %esp,%ebp
  800a12:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a15:	ff 75 10             	pushl  0x10(%ebp)
  800a18:	ff 75 0c             	pushl  0xc(%ebp)
  800a1b:	ff 75 08             	pushl  0x8(%ebp)
  800a1e:	e8 82 ff ff ff       	call   8009a5 <memmove>
}
  800a23:	c9                   	leave  
  800a24:	c3                   	ret    

00800a25 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a25:	f3 0f 1e fb          	endbr32 
  800a29:	55                   	push   %ebp
  800a2a:	89 e5                	mov    %esp,%ebp
  800a2c:	56                   	push   %esi
  800a2d:	53                   	push   %ebx
  800a2e:	8b 45 08             	mov    0x8(%ebp),%eax
  800a31:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a34:	89 c6                	mov    %eax,%esi
  800a36:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a39:	39 f0                	cmp    %esi,%eax
  800a3b:	74 1c                	je     800a59 <memcmp+0x34>
		if (*s1 != *s2)
  800a3d:	0f b6 08             	movzbl (%eax),%ecx
  800a40:	0f b6 1a             	movzbl (%edx),%ebx
  800a43:	38 d9                	cmp    %bl,%cl
  800a45:	75 08                	jne    800a4f <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a47:	83 c0 01             	add    $0x1,%eax
  800a4a:	83 c2 01             	add    $0x1,%edx
  800a4d:	eb ea                	jmp    800a39 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a4f:	0f b6 c1             	movzbl %cl,%eax
  800a52:	0f b6 db             	movzbl %bl,%ebx
  800a55:	29 d8                	sub    %ebx,%eax
  800a57:	eb 05                	jmp    800a5e <memcmp+0x39>
	}

	return 0;
  800a59:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a5e:	5b                   	pop    %ebx
  800a5f:	5e                   	pop    %esi
  800a60:	5d                   	pop    %ebp
  800a61:	c3                   	ret    

00800a62 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a62:	f3 0f 1e fb          	endbr32 
  800a66:	55                   	push   %ebp
  800a67:	89 e5                	mov    %esp,%ebp
  800a69:	8b 45 08             	mov    0x8(%ebp),%eax
  800a6c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a6f:	89 c2                	mov    %eax,%edx
  800a71:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a74:	39 d0                	cmp    %edx,%eax
  800a76:	73 09                	jae    800a81 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a78:	38 08                	cmp    %cl,(%eax)
  800a7a:	74 05                	je     800a81 <memfind+0x1f>
	for (; s < ends; s++)
  800a7c:	83 c0 01             	add    $0x1,%eax
  800a7f:	eb f3                	jmp    800a74 <memfind+0x12>
			break;
	return (void *) s;
}
  800a81:	5d                   	pop    %ebp
  800a82:	c3                   	ret    

00800a83 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a83:	f3 0f 1e fb          	endbr32 
  800a87:	55                   	push   %ebp
  800a88:	89 e5                	mov    %esp,%ebp
  800a8a:	57                   	push   %edi
  800a8b:	56                   	push   %esi
  800a8c:	53                   	push   %ebx
  800a8d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a90:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a93:	eb 03                	jmp    800a98 <strtol+0x15>
		s++;
  800a95:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a98:	0f b6 01             	movzbl (%ecx),%eax
  800a9b:	3c 20                	cmp    $0x20,%al
  800a9d:	74 f6                	je     800a95 <strtol+0x12>
  800a9f:	3c 09                	cmp    $0x9,%al
  800aa1:	74 f2                	je     800a95 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800aa3:	3c 2b                	cmp    $0x2b,%al
  800aa5:	74 2a                	je     800ad1 <strtol+0x4e>
	int neg = 0;
  800aa7:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800aac:	3c 2d                	cmp    $0x2d,%al
  800aae:	74 2b                	je     800adb <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ab0:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800ab6:	75 0f                	jne    800ac7 <strtol+0x44>
  800ab8:	80 39 30             	cmpb   $0x30,(%ecx)
  800abb:	74 28                	je     800ae5 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800abd:	85 db                	test   %ebx,%ebx
  800abf:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ac4:	0f 44 d8             	cmove  %eax,%ebx
  800ac7:	b8 00 00 00 00       	mov    $0x0,%eax
  800acc:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800acf:	eb 46                	jmp    800b17 <strtol+0x94>
		s++;
  800ad1:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800ad4:	bf 00 00 00 00       	mov    $0x0,%edi
  800ad9:	eb d5                	jmp    800ab0 <strtol+0x2d>
		s++, neg = 1;
  800adb:	83 c1 01             	add    $0x1,%ecx
  800ade:	bf 01 00 00 00       	mov    $0x1,%edi
  800ae3:	eb cb                	jmp    800ab0 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ae5:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800ae9:	74 0e                	je     800af9 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800aeb:	85 db                	test   %ebx,%ebx
  800aed:	75 d8                	jne    800ac7 <strtol+0x44>
		s++, base = 8;
  800aef:	83 c1 01             	add    $0x1,%ecx
  800af2:	bb 08 00 00 00       	mov    $0x8,%ebx
  800af7:	eb ce                	jmp    800ac7 <strtol+0x44>
		s += 2, base = 16;
  800af9:	83 c1 02             	add    $0x2,%ecx
  800afc:	bb 10 00 00 00       	mov    $0x10,%ebx
  800b01:	eb c4                	jmp    800ac7 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800b03:	0f be d2             	movsbl %dl,%edx
  800b06:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800b09:	3b 55 10             	cmp    0x10(%ebp),%edx
  800b0c:	7d 3a                	jge    800b48 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800b0e:	83 c1 01             	add    $0x1,%ecx
  800b11:	0f af 45 10          	imul   0x10(%ebp),%eax
  800b15:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800b17:	0f b6 11             	movzbl (%ecx),%edx
  800b1a:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b1d:	89 f3                	mov    %esi,%ebx
  800b1f:	80 fb 09             	cmp    $0x9,%bl
  800b22:	76 df                	jbe    800b03 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b24:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b27:	89 f3                	mov    %esi,%ebx
  800b29:	80 fb 19             	cmp    $0x19,%bl
  800b2c:	77 08                	ja     800b36 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b2e:	0f be d2             	movsbl %dl,%edx
  800b31:	83 ea 57             	sub    $0x57,%edx
  800b34:	eb d3                	jmp    800b09 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b36:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b39:	89 f3                	mov    %esi,%ebx
  800b3b:	80 fb 19             	cmp    $0x19,%bl
  800b3e:	77 08                	ja     800b48 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b40:	0f be d2             	movsbl %dl,%edx
  800b43:	83 ea 37             	sub    $0x37,%edx
  800b46:	eb c1                	jmp    800b09 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b48:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b4c:	74 05                	je     800b53 <strtol+0xd0>
		*endptr = (char *) s;
  800b4e:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b51:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b53:	89 c2                	mov    %eax,%edx
  800b55:	f7 da                	neg    %edx
  800b57:	85 ff                	test   %edi,%edi
  800b59:	0f 45 c2             	cmovne %edx,%eax
}
  800b5c:	5b                   	pop    %ebx
  800b5d:	5e                   	pop    %esi
  800b5e:	5f                   	pop    %edi
  800b5f:	5d                   	pop    %ebp
  800b60:	c3                   	ret    

00800b61 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b61:	f3 0f 1e fb          	endbr32 
  800b65:	55                   	push   %ebp
  800b66:	89 e5                	mov    %esp,%ebp
  800b68:	57                   	push   %edi
  800b69:	56                   	push   %esi
  800b6a:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b6b:	b8 00 00 00 00       	mov    $0x0,%eax
  800b70:	8b 55 08             	mov    0x8(%ebp),%edx
  800b73:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b76:	89 c3                	mov    %eax,%ebx
  800b78:	89 c7                	mov    %eax,%edi
  800b7a:	89 c6                	mov    %eax,%esi
  800b7c:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b7e:	5b                   	pop    %ebx
  800b7f:	5e                   	pop    %esi
  800b80:	5f                   	pop    %edi
  800b81:	5d                   	pop    %ebp
  800b82:	c3                   	ret    

00800b83 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b83:	f3 0f 1e fb          	endbr32 
  800b87:	55                   	push   %ebp
  800b88:	89 e5                	mov    %esp,%ebp
  800b8a:	57                   	push   %edi
  800b8b:	56                   	push   %esi
  800b8c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b8d:	ba 00 00 00 00       	mov    $0x0,%edx
  800b92:	b8 01 00 00 00       	mov    $0x1,%eax
  800b97:	89 d1                	mov    %edx,%ecx
  800b99:	89 d3                	mov    %edx,%ebx
  800b9b:	89 d7                	mov    %edx,%edi
  800b9d:	89 d6                	mov    %edx,%esi
  800b9f:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800ba1:	5b                   	pop    %ebx
  800ba2:	5e                   	pop    %esi
  800ba3:	5f                   	pop    %edi
  800ba4:	5d                   	pop    %ebp
  800ba5:	c3                   	ret    

00800ba6 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800ba6:	f3 0f 1e fb          	endbr32 
  800baa:	55                   	push   %ebp
  800bab:	89 e5                	mov    %esp,%ebp
  800bad:	57                   	push   %edi
  800bae:	56                   	push   %esi
  800baf:	53                   	push   %ebx
  800bb0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bb3:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bb8:	8b 55 08             	mov    0x8(%ebp),%edx
  800bbb:	b8 03 00 00 00       	mov    $0x3,%eax
  800bc0:	89 cb                	mov    %ecx,%ebx
  800bc2:	89 cf                	mov    %ecx,%edi
  800bc4:	89 ce                	mov    %ecx,%esi
  800bc6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bc8:	85 c0                	test   %eax,%eax
  800bca:	7f 08                	jg     800bd4 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800bcc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800bcf:	5b                   	pop    %ebx
  800bd0:	5e                   	pop    %esi
  800bd1:	5f                   	pop    %edi
  800bd2:	5d                   	pop    %ebp
  800bd3:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800bd4:	83 ec 0c             	sub    $0xc,%esp
  800bd7:	50                   	push   %eax
  800bd8:	6a 03                	push   $0x3
  800bda:	68 7f 23 80 00       	push   $0x80237f
  800bdf:	6a 23                	push   $0x23
  800be1:	68 9c 23 80 00       	push   $0x80239c
  800be6:	e8 44 f5 ff ff       	call   80012f <_panic>

00800beb <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800beb:	f3 0f 1e fb          	endbr32 
  800bef:	55                   	push   %ebp
  800bf0:	89 e5                	mov    %esp,%ebp
  800bf2:	57                   	push   %edi
  800bf3:	56                   	push   %esi
  800bf4:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bf5:	ba 00 00 00 00       	mov    $0x0,%edx
  800bfa:	b8 02 00 00 00       	mov    $0x2,%eax
  800bff:	89 d1                	mov    %edx,%ecx
  800c01:	89 d3                	mov    %edx,%ebx
  800c03:	89 d7                	mov    %edx,%edi
  800c05:	89 d6                	mov    %edx,%esi
  800c07:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800c09:	5b                   	pop    %ebx
  800c0a:	5e                   	pop    %esi
  800c0b:	5f                   	pop    %edi
  800c0c:	5d                   	pop    %ebp
  800c0d:	c3                   	ret    

00800c0e <sys_yield>:

void
sys_yield(void)
{
  800c0e:	f3 0f 1e fb          	endbr32 
  800c12:	55                   	push   %ebp
  800c13:	89 e5                	mov    %esp,%ebp
  800c15:	57                   	push   %edi
  800c16:	56                   	push   %esi
  800c17:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c18:	ba 00 00 00 00       	mov    $0x0,%edx
  800c1d:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c22:	89 d1                	mov    %edx,%ecx
  800c24:	89 d3                	mov    %edx,%ebx
  800c26:	89 d7                	mov    %edx,%edi
  800c28:	89 d6                	mov    %edx,%esi
  800c2a:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c2c:	5b                   	pop    %ebx
  800c2d:	5e                   	pop    %esi
  800c2e:	5f                   	pop    %edi
  800c2f:	5d                   	pop    %ebp
  800c30:	c3                   	ret    

00800c31 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c31:	f3 0f 1e fb          	endbr32 
  800c35:	55                   	push   %ebp
  800c36:	89 e5                	mov    %esp,%ebp
  800c38:	57                   	push   %edi
  800c39:	56                   	push   %esi
  800c3a:	53                   	push   %ebx
  800c3b:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c3e:	be 00 00 00 00       	mov    $0x0,%esi
  800c43:	8b 55 08             	mov    0x8(%ebp),%edx
  800c46:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c49:	b8 04 00 00 00       	mov    $0x4,%eax
  800c4e:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c51:	89 f7                	mov    %esi,%edi
  800c53:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c55:	85 c0                	test   %eax,%eax
  800c57:	7f 08                	jg     800c61 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c59:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c5c:	5b                   	pop    %ebx
  800c5d:	5e                   	pop    %esi
  800c5e:	5f                   	pop    %edi
  800c5f:	5d                   	pop    %ebp
  800c60:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c61:	83 ec 0c             	sub    $0xc,%esp
  800c64:	50                   	push   %eax
  800c65:	6a 04                	push   $0x4
  800c67:	68 7f 23 80 00       	push   $0x80237f
  800c6c:	6a 23                	push   $0x23
  800c6e:	68 9c 23 80 00       	push   $0x80239c
  800c73:	e8 b7 f4 ff ff       	call   80012f <_panic>

00800c78 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c78:	f3 0f 1e fb          	endbr32 
  800c7c:	55                   	push   %ebp
  800c7d:	89 e5                	mov    %esp,%ebp
  800c7f:	57                   	push   %edi
  800c80:	56                   	push   %esi
  800c81:	53                   	push   %ebx
  800c82:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c85:	8b 55 08             	mov    0x8(%ebp),%edx
  800c88:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c8b:	b8 05 00 00 00       	mov    $0x5,%eax
  800c90:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c93:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c96:	8b 75 18             	mov    0x18(%ebp),%esi
  800c99:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c9b:	85 c0                	test   %eax,%eax
  800c9d:	7f 08                	jg     800ca7 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c9f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ca2:	5b                   	pop    %ebx
  800ca3:	5e                   	pop    %esi
  800ca4:	5f                   	pop    %edi
  800ca5:	5d                   	pop    %ebp
  800ca6:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ca7:	83 ec 0c             	sub    $0xc,%esp
  800caa:	50                   	push   %eax
  800cab:	6a 05                	push   $0x5
  800cad:	68 7f 23 80 00       	push   $0x80237f
  800cb2:	6a 23                	push   $0x23
  800cb4:	68 9c 23 80 00       	push   $0x80239c
  800cb9:	e8 71 f4 ff ff       	call   80012f <_panic>

00800cbe <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800cbe:	f3 0f 1e fb          	endbr32 
  800cc2:	55                   	push   %ebp
  800cc3:	89 e5                	mov    %esp,%ebp
  800cc5:	57                   	push   %edi
  800cc6:	56                   	push   %esi
  800cc7:	53                   	push   %ebx
  800cc8:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ccb:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cd0:	8b 55 08             	mov    0x8(%ebp),%edx
  800cd3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cd6:	b8 06 00 00 00       	mov    $0x6,%eax
  800cdb:	89 df                	mov    %ebx,%edi
  800cdd:	89 de                	mov    %ebx,%esi
  800cdf:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ce1:	85 c0                	test   %eax,%eax
  800ce3:	7f 08                	jg     800ced <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800ce5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce8:	5b                   	pop    %ebx
  800ce9:	5e                   	pop    %esi
  800cea:	5f                   	pop    %edi
  800ceb:	5d                   	pop    %ebp
  800cec:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ced:	83 ec 0c             	sub    $0xc,%esp
  800cf0:	50                   	push   %eax
  800cf1:	6a 06                	push   $0x6
  800cf3:	68 7f 23 80 00       	push   $0x80237f
  800cf8:	6a 23                	push   $0x23
  800cfa:	68 9c 23 80 00       	push   $0x80239c
  800cff:	e8 2b f4 ff ff       	call   80012f <_panic>

00800d04 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800d04:	f3 0f 1e fb          	endbr32 
  800d08:	55                   	push   %ebp
  800d09:	89 e5                	mov    %esp,%ebp
  800d0b:	57                   	push   %edi
  800d0c:	56                   	push   %esi
  800d0d:	53                   	push   %ebx
  800d0e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d11:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d16:	8b 55 08             	mov    0x8(%ebp),%edx
  800d19:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d1c:	b8 08 00 00 00       	mov    $0x8,%eax
  800d21:	89 df                	mov    %ebx,%edi
  800d23:	89 de                	mov    %ebx,%esi
  800d25:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d27:	85 c0                	test   %eax,%eax
  800d29:	7f 08                	jg     800d33 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d2b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d2e:	5b                   	pop    %ebx
  800d2f:	5e                   	pop    %esi
  800d30:	5f                   	pop    %edi
  800d31:	5d                   	pop    %ebp
  800d32:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d33:	83 ec 0c             	sub    $0xc,%esp
  800d36:	50                   	push   %eax
  800d37:	6a 08                	push   $0x8
  800d39:	68 7f 23 80 00       	push   $0x80237f
  800d3e:	6a 23                	push   $0x23
  800d40:	68 9c 23 80 00       	push   $0x80239c
  800d45:	e8 e5 f3 ff ff       	call   80012f <_panic>

00800d4a <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d4a:	f3 0f 1e fb          	endbr32 
  800d4e:	55                   	push   %ebp
  800d4f:	89 e5                	mov    %esp,%ebp
  800d51:	57                   	push   %edi
  800d52:	56                   	push   %esi
  800d53:	53                   	push   %ebx
  800d54:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d57:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d5c:	8b 55 08             	mov    0x8(%ebp),%edx
  800d5f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d62:	b8 09 00 00 00       	mov    $0x9,%eax
  800d67:	89 df                	mov    %ebx,%edi
  800d69:	89 de                	mov    %ebx,%esi
  800d6b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d6d:	85 c0                	test   %eax,%eax
  800d6f:	7f 08                	jg     800d79 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d71:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d74:	5b                   	pop    %ebx
  800d75:	5e                   	pop    %esi
  800d76:	5f                   	pop    %edi
  800d77:	5d                   	pop    %ebp
  800d78:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d79:	83 ec 0c             	sub    $0xc,%esp
  800d7c:	50                   	push   %eax
  800d7d:	6a 09                	push   $0x9
  800d7f:	68 7f 23 80 00       	push   $0x80237f
  800d84:	6a 23                	push   $0x23
  800d86:	68 9c 23 80 00       	push   $0x80239c
  800d8b:	e8 9f f3 ff ff       	call   80012f <_panic>

00800d90 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d90:	f3 0f 1e fb          	endbr32 
  800d94:	55                   	push   %ebp
  800d95:	89 e5                	mov    %esp,%ebp
  800d97:	57                   	push   %edi
  800d98:	56                   	push   %esi
  800d99:	53                   	push   %ebx
  800d9a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d9d:	bb 00 00 00 00       	mov    $0x0,%ebx
  800da2:	8b 55 08             	mov    0x8(%ebp),%edx
  800da5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da8:	b8 0a 00 00 00       	mov    $0xa,%eax
  800dad:	89 df                	mov    %ebx,%edi
  800daf:	89 de                	mov    %ebx,%esi
  800db1:	cd 30                	int    $0x30
	if(check && ret > 0)
  800db3:	85 c0                	test   %eax,%eax
  800db5:	7f 08                	jg     800dbf <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800db7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dba:	5b                   	pop    %ebx
  800dbb:	5e                   	pop    %esi
  800dbc:	5f                   	pop    %edi
  800dbd:	5d                   	pop    %ebp
  800dbe:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dbf:	83 ec 0c             	sub    $0xc,%esp
  800dc2:	50                   	push   %eax
  800dc3:	6a 0a                	push   $0xa
  800dc5:	68 7f 23 80 00       	push   $0x80237f
  800dca:	6a 23                	push   $0x23
  800dcc:	68 9c 23 80 00       	push   $0x80239c
  800dd1:	e8 59 f3 ff ff       	call   80012f <_panic>

00800dd6 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800dd6:	f3 0f 1e fb          	endbr32 
  800dda:	55                   	push   %ebp
  800ddb:	89 e5                	mov    %esp,%ebp
  800ddd:	57                   	push   %edi
  800dde:	56                   	push   %esi
  800ddf:	53                   	push   %ebx
	asm volatile("int %1\n"
  800de0:	8b 55 08             	mov    0x8(%ebp),%edx
  800de3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800de6:	b8 0c 00 00 00       	mov    $0xc,%eax
  800deb:	be 00 00 00 00       	mov    $0x0,%esi
  800df0:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800df3:	8b 7d 14             	mov    0x14(%ebp),%edi
  800df6:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800df8:	5b                   	pop    %ebx
  800df9:	5e                   	pop    %esi
  800dfa:	5f                   	pop    %edi
  800dfb:	5d                   	pop    %ebp
  800dfc:	c3                   	ret    

00800dfd <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800dfd:	f3 0f 1e fb          	endbr32 
  800e01:	55                   	push   %ebp
  800e02:	89 e5                	mov    %esp,%ebp
  800e04:	57                   	push   %edi
  800e05:	56                   	push   %esi
  800e06:	53                   	push   %ebx
  800e07:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e0a:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e0f:	8b 55 08             	mov    0x8(%ebp),%edx
  800e12:	b8 0d 00 00 00       	mov    $0xd,%eax
  800e17:	89 cb                	mov    %ecx,%ebx
  800e19:	89 cf                	mov    %ecx,%edi
  800e1b:	89 ce                	mov    %ecx,%esi
  800e1d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e1f:	85 c0                	test   %eax,%eax
  800e21:	7f 08                	jg     800e2b <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e23:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e26:	5b                   	pop    %ebx
  800e27:	5e                   	pop    %esi
  800e28:	5f                   	pop    %edi
  800e29:	5d                   	pop    %ebp
  800e2a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e2b:	83 ec 0c             	sub    $0xc,%esp
  800e2e:	50                   	push   %eax
  800e2f:	6a 0d                	push   $0xd
  800e31:	68 7f 23 80 00       	push   $0x80237f
  800e36:	6a 23                	push   $0x23
  800e38:	68 9c 23 80 00       	push   $0x80239c
  800e3d:	e8 ed f2 ff ff       	call   80012f <_panic>

00800e42 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  800e42:	f3 0f 1e fb          	endbr32 
  800e46:	55                   	push   %ebp
  800e47:	89 e5                	mov    %esp,%ebp
  800e49:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  800e4c:	83 3d 08 40 80 00 00 	cmpl   $0x0,0x804008
  800e53:	74 27                	je     800e7c <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  800e55:	8b 45 08             	mov    0x8(%ebp),%eax
  800e58:	a3 08 40 80 00       	mov    %eax,0x804008
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  800e5d:	a1 04 40 80 00       	mov    0x804004,%eax
  800e62:	8b 40 48             	mov    0x48(%eax),%eax
  800e65:	83 ec 08             	sub    $0x8,%esp
  800e68:	68 bc 0e 80 00       	push   $0x800ebc
  800e6d:	50                   	push   %eax
  800e6e:	e8 1d ff ff ff       	call   800d90 <sys_env_set_pgfault_upcall>
  800e73:	83 c4 10             	add    $0x10,%esp
  800e76:	85 c0                	test   %eax,%eax
  800e78:	78 2e                	js     800ea8 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  800e7a:	c9                   	leave  
  800e7b:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  800e7c:	83 ec 04             	sub    $0x4,%esp
  800e7f:	6a 07                	push   $0x7
  800e81:	68 00 f0 bf ee       	push   $0xeebff000
  800e86:	6a 00                	push   $0x0
  800e88:	e8 a4 fd ff ff       	call   800c31 <sys_page_alloc>
  800e8d:	83 c4 10             	add    $0x10,%esp
  800e90:	85 c0                	test   %eax,%eax
  800e92:	79 c1                	jns    800e55 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  800e94:	83 ec 04             	sub    $0x4,%esp
  800e97:	68 ac 23 80 00       	push   $0x8023ac
  800e9c:	6a 21                	push   $0x21
  800e9e:	68 0e 24 80 00       	push   $0x80240e
  800ea3:	e8 87 f2 ff ff       	call   80012f <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  800ea8:	83 ec 04             	sub    $0x4,%esp
  800eab:	68 d8 23 80 00       	push   $0x8023d8
  800eb0:	6a 27                	push   $0x27
  800eb2:	68 0e 24 80 00       	push   $0x80240e
  800eb7:	e8 73 f2 ff ff       	call   80012f <_panic>

00800ebc <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  800ebc:	54                   	push   %esp
	movl _pgfault_handler, %eax
  800ebd:	a1 08 40 80 00       	mov    0x804008,%eax
	call *%eax
  800ec2:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  800ec4:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  800ec7:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  800ecb:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  800ece:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  800ed2:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  800ed6:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  800ed9:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  800edc:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  800edd:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  800ee0:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  800ee1:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  800ee2:	c3                   	ret    

00800ee3 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800ee3:	f3 0f 1e fb          	endbr32 
  800ee7:	55                   	push   %ebp
  800ee8:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800eea:	8b 45 08             	mov    0x8(%ebp),%eax
  800eed:	05 00 00 00 30       	add    $0x30000000,%eax
  800ef2:	c1 e8 0c             	shr    $0xc,%eax
}
  800ef5:	5d                   	pop    %ebp
  800ef6:	c3                   	ret    

00800ef7 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800ef7:	f3 0f 1e fb          	endbr32 
  800efb:	55                   	push   %ebp
  800efc:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800efe:	8b 45 08             	mov    0x8(%ebp),%eax
  800f01:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800f06:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800f0b:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800f10:	5d                   	pop    %ebp
  800f11:	c3                   	ret    

00800f12 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800f12:	f3 0f 1e fb          	endbr32 
  800f16:	55                   	push   %ebp
  800f17:	89 e5                	mov    %esp,%ebp
  800f19:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800f1e:	89 c2                	mov    %eax,%edx
  800f20:	c1 ea 16             	shr    $0x16,%edx
  800f23:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800f2a:	f6 c2 01             	test   $0x1,%dl
  800f2d:	74 2d                	je     800f5c <fd_alloc+0x4a>
  800f2f:	89 c2                	mov    %eax,%edx
  800f31:	c1 ea 0c             	shr    $0xc,%edx
  800f34:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800f3b:	f6 c2 01             	test   $0x1,%dl
  800f3e:	74 1c                	je     800f5c <fd_alloc+0x4a>
  800f40:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  800f45:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  800f4a:	75 d2                	jne    800f1e <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  800f4c:	8b 45 08             	mov    0x8(%ebp),%eax
  800f4f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  800f55:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  800f5a:	eb 0a                	jmp    800f66 <fd_alloc+0x54>
			*fd_store = fd;
  800f5c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800f5f:	89 01                	mov    %eax,(%ecx)
			return 0;
  800f61:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800f66:	5d                   	pop    %ebp
  800f67:	c3                   	ret    

00800f68 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  800f68:	f3 0f 1e fb          	endbr32 
  800f6c:	55                   	push   %ebp
  800f6d:	89 e5                	mov    %esp,%ebp
  800f6f:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  800f72:	83 f8 1f             	cmp    $0x1f,%eax
  800f75:	77 30                	ja     800fa7 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  800f77:	c1 e0 0c             	shl    $0xc,%eax
  800f7a:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  800f7f:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  800f85:	f6 c2 01             	test   $0x1,%dl
  800f88:	74 24                	je     800fae <fd_lookup+0x46>
  800f8a:	89 c2                	mov    %eax,%edx
  800f8c:	c1 ea 0c             	shr    $0xc,%edx
  800f8f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800f96:	f6 c2 01             	test   $0x1,%dl
  800f99:	74 1a                	je     800fb5 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  800f9b:	8b 55 0c             	mov    0xc(%ebp),%edx
  800f9e:	89 02                	mov    %eax,(%edx)
	return 0;
  800fa0:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800fa5:	5d                   	pop    %ebp
  800fa6:	c3                   	ret    
		return -E_INVAL;
  800fa7:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fac:	eb f7                	jmp    800fa5 <fd_lookup+0x3d>
		return -E_INVAL;
  800fae:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fb3:	eb f0                	jmp    800fa5 <fd_lookup+0x3d>
  800fb5:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fba:	eb e9                	jmp    800fa5 <fd_lookup+0x3d>

00800fbc <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  800fbc:	f3 0f 1e fb          	endbr32 
  800fc0:	55                   	push   %ebp
  800fc1:	89 e5                	mov    %esp,%ebp
  800fc3:	83 ec 08             	sub    $0x8,%esp
  800fc6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800fc9:	ba 98 24 80 00       	mov    $0x802498,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  800fce:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  800fd3:	39 08                	cmp    %ecx,(%eax)
  800fd5:	74 33                	je     80100a <dev_lookup+0x4e>
  800fd7:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  800fda:	8b 02                	mov    (%edx),%eax
  800fdc:	85 c0                	test   %eax,%eax
  800fde:	75 f3                	jne    800fd3 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  800fe0:	a1 04 40 80 00       	mov    0x804004,%eax
  800fe5:	8b 40 48             	mov    0x48(%eax),%eax
  800fe8:	83 ec 04             	sub    $0x4,%esp
  800feb:	51                   	push   %ecx
  800fec:	50                   	push   %eax
  800fed:	68 1c 24 80 00       	push   $0x80241c
  800ff2:	e8 1f f2 ff ff       	call   800216 <cprintf>
	*dev = 0;
  800ff7:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ffa:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801000:	83 c4 10             	add    $0x10,%esp
  801003:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801008:	c9                   	leave  
  801009:	c3                   	ret    
			*dev = devtab[i];
  80100a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80100d:	89 01                	mov    %eax,(%ecx)
			return 0;
  80100f:	b8 00 00 00 00       	mov    $0x0,%eax
  801014:	eb f2                	jmp    801008 <dev_lookup+0x4c>

00801016 <fd_close>:
{
  801016:	f3 0f 1e fb          	endbr32 
  80101a:	55                   	push   %ebp
  80101b:	89 e5                	mov    %esp,%ebp
  80101d:	57                   	push   %edi
  80101e:	56                   	push   %esi
  80101f:	53                   	push   %ebx
  801020:	83 ec 24             	sub    $0x24,%esp
  801023:	8b 75 08             	mov    0x8(%ebp),%esi
  801026:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801029:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80102c:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80102d:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  801033:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801036:	50                   	push   %eax
  801037:	e8 2c ff ff ff       	call   800f68 <fd_lookup>
  80103c:	89 c3                	mov    %eax,%ebx
  80103e:	83 c4 10             	add    $0x10,%esp
  801041:	85 c0                	test   %eax,%eax
  801043:	78 05                	js     80104a <fd_close+0x34>
	    || fd != fd2)
  801045:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801048:	74 16                	je     801060 <fd_close+0x4a>
		return (must_exist ? r : 0);
  80104a:	89 f8                	mov    %edi,%eax
  80104c:	84 c0                	test   %al,%al
  80104e:	b8 00 00 00 00       	mov    $0x0,%eax
  801053:	0f 44 d8             	cmove  %eax,%ebx
}
  801056:	89 d8                	mov    %ebx,%eax
  801058:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80105b:	5b                   	pop    %ebx
  80105c:	5e                   	pop    %esi
  80105d:	5f                   	pop    %edi
  80105e:	5d                   	pop    %ebp
  80105f:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801060:	83 ec 08             	sub    $0x8,%esp
  801063:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801066:	50                   	push   %eax
  801067:	ff 36                	pushl  (%esi)
  801069:	e8 4e ff ff ff       	call   800fbc <dev_lookup>
  80106e:	89 c3                	mov    %eax,%ebx
  801070:	83 c4 10             	add    $0x10,%esp
  801073:	85 c0                	test   %eax,%eax
  801075:	78 1a                	js     801091 <fd_close+0x7b>
		if (dev->dev_close)
  801077:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80107a:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  80107d:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801082:	85 c0                	test   %eax,%eax
  801084:	74 0b                	je     801091 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801086:	83 ec 0c             	sub    $0xc,%esp
  801089:	56                   	push   %esi
  80108a:	ff d0                	call   *%eax
  80108c:	89 c3                	mov    %eax,%ebx
  80108e:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801091:	83 ec 08             	sub    $0x8,%esp
  801094:	56                   	push   %esi
  801095:	6a 00                	push   $0x0
  801097:	e8 22 fc ff ff       	call   800cbe <sys_page_unmap>
	return r;
  80109c:	83 c4 10             	add    $0x10,%esp
  80109f:	eb b5                	jmp    801056 <fd_close+0x40>

008010a1 <close>:

int
close(int fdnum)
{
  8010a1:	f3 0f 1e fb          	endbr32 
  8010a5:	55                   	push   %ebp
  8010a6:	89 e5                	mov    %esp,%ebp
  8010a8:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8010ab:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8010ae:	50                   	push   %eax
  8010af:	ff 75 08             	pushl  0x8(%ebp)
  8010b2:	e8 b1 fe ff ff       	call   800f68 <fd_lookup>
  8010b7:	83 c4 10             	add    $0x10,%esp
  8010ba:	85 c0                	test   %eax,%eax
  8010bc:	79 02                	jns    8010c0 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8010be:	c9                   	leave  
  8010bf:	c3                   	ret    
		return fd_close(fd, 1);
  8010c0:	83 ec 08             	sub    $0x8,%esp
  8010c3:	6a 01                	push   $0x1
  8010c5:	ff 75 f4             	pushl  -0xc(%ebp)
  8010c8:	e8 49 ff ff ff       	call   801016 <fd_close>
  8010cd:	83 c4 10             	add    $0x10,%esp
  8010d0:	eb ec                	jmp    8010be <close+0x1d>

008010d2 <close_all>:

void
close_all(void)
{
  8010d2:	f3 0f 1e fb          	endbr32 
  8010d6:	55                   	push   %ebp
  8010d7:	89 e5                	mov    %esp,%ebp
  8010d9:	53                   	push   %ebx
  8010da:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8010dd:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8010e2:	83 ec 0c             	sub    $0xc,%esp
  8010e5:	53                   	push   %ebx
  8010e6:	e8 b6 ff ff ff       	call   8010a1 <close>
	for (i = 0; i < MAXFD; i++)
  8010eb:	83 c3 01             	add    $0x1,%ebx
  8010ee:	83 c4 10             	add    $0x10,%esp
  8010f1:	83 fb 20             	cmp    $0x20,%ebx
  8010f4:	75 ec                	jne    8010e2 <close_all+0x10>
}
  8010f6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8010f9:	c9                   	leave  
  8010fa:	c3                   	ret    

008010fb <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8010fb:	f3 0f 1e fb          	endbr32 
  8010ff:	55                   	push   %ebp
  801100:	89 e5                	mov    %esp,%ebp
  801102:	57                   	push   %edi
  801103:	56                   	push   %esi
  801104:	53                   	push   %ebx
  801105:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801108:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80110b:	50                   	push   %eax
  80110c:	ff 75 08             	pushl  0x8(%ebp)
  80110f:	e8 54 fe ff ff       	call   800f68 <fd_lookup>
  801114:	89 c3                	mov    %eax,%ebx
  801116:	83 c4 10             	add    $0x10,%esp
  801119:	85 c0                	test   %eax,%eax
  80111b:	0f 88 81 00 00 00    	js     8011a2 <dup+0xa7>
		return r;
	close(newfdnum);
  801121:	83 ec 0c             	sub    $0xc,%esp
  801124:	ff 75 0c             	pushl  0xc(%ebp)
  801127:	e8 75 ff ff ff       	call   8010a1 <close>

	newfd = INDEX2FD(newfdnum);
  80112c:	8b 75 0c             	mov    0xc(%ebp),%esi
  80112f:	c1 e6 0c             	shl    $0xc,%esi
  801132:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801138:	83 c4 04             	add    $0x4,%esp
  80113b:	ff 75 e4             	pushl  -0x1c(%ebp)
  80113e:	e8 b4 fd ff ff       	call   800ef7 <fd2data>
  801143:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801145:	89 34 24             	mov    %esi,(%esp)
  801148:	e8 aa fd ff ff       	call   800ef7 <fd2data>
  80114d:	83 c4 10             	add    $0x10,%esp
  801150:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801152:	89 d8                	mov    %ebx,%eax
  801154:	c1 e8 16             	shr    $0x16,%eax
  801157:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80115e:	a8 01                	test   $0x1,%al
  801160:	74 11                	je     801173 <dup+0x78>
  801162:	89 d8                	mov    %ebx,%eax
  801164:	c1 e8 0c             	shr    $0xc,%eax
  801167:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80116e:	f6 c2 01             	test   $0x1,%dl
  801171:	75 39                	jne    8011ac <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801173:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801176:	89 d0                	mov    %edx,%eax
  801178:	c1 e8 0c             	shr    $0xc,%eax
  80117b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801182:	83 ec 0c             	sub    $0xc,%esp
  801185:	25 07 0e 00 00       	and    $0xe07,%eax
  80118a:	50                   	push   %eax
  80118b:	56                   	push   %esi
  80118c:	6a 00                	push   $0x0
  80118e:	52                   	push   %edx
  80118f:	6a 00                	push   $0x0
  801191:	e8 e2 fa ff ff       	call   800c78 <sys_page_map>
  801196:	89 c3                	mov    %eax,%ebx
  801198:	83 c4 20             	add    $0x20,%esp
  80119b:	85 c0                	test   %eax,%eax
  80119d:	78 31                	js     8011d0 <dup+0xd5>
		goto err;

	return newfdnum;
  80119f:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8011a2:	89 d8                	mov    %ebx,%eax
  8011a4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8011a7:	5b                   	pop    %ebx
  8011a8:	5e                   	pop    %esi
  8011a9:	5f                   	pop    %edi
  8011aa:	5d                   	pop    %ebp
  8011ab:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8011ac:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8011b3:	83 ec 0c             	sub    $0xc,%esp
  8011b6:	25 07 0e 00 00       	and    $0xe07,%eax
  8011bb:	50                   	push   %eax
  8011bc:	57                   	push   %edi
  8011bd:	6a 00                	push   $0x0
  8011bf:	53                   	push   %ebx
  8011c0:	6a 00                	push   $0x0
  8011c2:	e8 b1 fa ff ff       	call   800c78 <sys_page_map>
  8011c7:	89 c3                	mov    %eax,%ebx
  8011c9:	83 c4 20             	add    $0x20,%esp
  8011cc:	85 c0                	test   %eax,%eax
  8011ce:	79 a3                	jns    801173 <dup+0x78>
	sys_page_unmap(0, newfd);
  8011d0:	83 ec 08             	sub    $0x8,%esp
  8011d3:	56                   	push   %esi
  8011d4:	6a 00                	push   $0x0
  8011d6:	e8 e3 fa ff ff       	call   800cbe <sys_page_unmap>
	sys_page_unmap(0, nva);
  8011db:	83 c4 08             	add    $0x8,%esp
  8011de:	57                   	push   %edi
  8011df:	6a 00                	push   $0x0
  8011e1:	e8 d8 fa ff ff       	call   800cbe <sys_page_unmap>
	return r;
  8011e6:	83 c4 10             	add    $0x10,%esp
  8011e9:	eb b7                	jmp    8011a2 <dup+0xa7>

008011eb <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8011eb:	f3 0f 1e fb          	endbr32 
  8011ef:	55                   	push   %ebp
  8011f0:	89 e5                	mov    %esp,%ebp
  8011f2:	53                   	push   %ebx
  8011f3:	83 ec 1c             	sub    $0x1c,%esp
  8011f6:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8011f9:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8011fc:	50                   	push   %eax
  8011fd:	53                   	push   %ebx
  8011fe:	e8 65 fd ff ff       	call   800f68 <fd_lookup>
  801203:	83 c4 10             	add    $0x10,%esp
  801206:	85 c0                	test   %eax,%eax
  801208:	78 3f                	js     801249 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80120a:	83 ec 08             	sub    $0x8,%esp
  80120d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801210:	50                   	push   %eax
  801211:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801214:	ff 30                	pushl  (%eax)
  801216:	e8 a1 fd ff ff       	call   800fbc <dev_lookup>
  80121b:	83 c4 10             	add    $0x10,%esp
  80121e:	85 c0                	test   %eax,%eax
  801220:	78 27                	js     801249 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801222:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801225:	8b 42 08             	mov    0x8(%edx),%eax
  801228:	83 e0 03             	and    $0x3,%eax
  80122b:	83 f8 01             	cmp    $0x1,%eax
  80122e:	74 1e                	je     80124e <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801230:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801233:	8b 40 08             	mov    0x8(%eax),%eax
  801236:	85 c0                	test   %eax,%eax
  801238:	74 35                	je     80126f <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80123a:	83 ec 04             	sub    $0x4,%esp
  80123d:	ff 75 10             	pushl  0x10(%ebp)
  801240:	ff 75 0c             	pushl  0xc(%ebp)
  801243:	52                   	push   %edx
  801244:	ff d0                	call   *%eax
  801246:	83 c4 10             	add    $0x10,%esp
}
  801249:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80124c:	c9                   	leave  
  80124d:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  80124e:	a1 04 40 80 00       	mov    0x804004,%eax
  801253:	8b 40 48             	mov    0x48(%eax),%eax
  801256:	83 ec 04             	sub    $0x4,%esp
  801259:	53                   	push   %ebx
  80125a:	50                   	push   %eax
  80125b:	68 5d 24 80 00       	push   $0x80245d
  801260:	e8 b1 ef ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  801265:	83 c4 10             	add    $0x10,%esp
  801268:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80126d:	eb da                	jmp    801249 <read+0x5e>
		return -E_NOT_SUPP;
  80126f:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801274:	eb d3                	jmp    801249 <read+0x5e>

00801276 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801276:	f3 0f 1e fb          	endbr32 
  80127a:	55                   	push   %ebp
  80127b:	89 e5                	mov    %esp,%ebp
  80127d:	57                   	push   %edi
  80127e:	56                   	push   %esi
  80127f:	53                   	push   %ebx
  801280:	83 ec 0c             	sub    $0xc,%esp
  801283:	8b 7d 08             	mov    0x8(%ebp),%edi
  801286:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801289:	bb 00 00 00 00       	mov    $0x0,%ebx
  80128e:	eb 02                	jmp    801292 <readn+0x1c>
  801290:	01 c3                	add    %eax,%ebx
  801292:	39 f3                	cmp    %esi,%ebx
  801294:	73 21                	jae    8012b7 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801296:	83 ec 04             	sub    $0x4,%esp
  801299:	89 f0                	mov    %esi,%eax
  80129b:	29 d8                	sub    %ebx,%eax
  80129d:	50                   	push   %eax
  80129e:	89 d8                	mov    %ebx,%eax
  8012a0:	03 45 0c             	add    0xc(%ebp),%eax
  8012a3:	50                   	push   %eax
  8012a4:	57                   	push   %edi
  8012a5:	e8 41 ff ff ff       	call   8011eb <read>
		if (m < 0)
  8012aa:	83 c4 10             	add    $0x10,%esp
  8012ad:	85 c0                	test   %eax,%eax
  8012af:	78 04                	js     8012b5 <readn+0x3f>
			return m;
		if (m == 0)
  8012b1:	75 dd                	jne    801290 <readn+0x1a>
  8012b3:	eb 02                	jmp    8012b7 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8012b5:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8012b7:	89 d8                	mov    %ebx,%eax
  8012b9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012bc:	5b                   	pop    %ebx
  8012bd:	5e                   	pop    %esi
  8012be:	5f                   	pop    %edi
  8012bf:	5d                   	pop    %ebp
  8012c0:	c3                   	ret    

008012c1 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8012c1:	f3 0f 1e fb          	endbr32 
  8012c5:	55                   	push   %ebp
  8012c6:	89 e5                	mov    %esp,%ebp
  8012c8:	53                   	push   %ebx
  8012c9:	83 ec 1c             	sub    $0x1c,%esp
  8012cc:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8012cf:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8012d2:	50                   	push   %eax
  8012d3:	53                   	push   %ebx
  8012d4:	e8 8f fc ff ff       	call   800f68 <fd_lookup>
  8012d9:	83 c4 10             	add    $0x10,%esp
  8012dc:	85 c0                	test   %eax,%eax
  8012de:	78 3a                	js     80131a <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8012e0:	83 ec 08             	sub    $0x8,%esp
  8012e3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8012e6:	50                   	push   %eax
  8012e7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8012ea:	ff 30                	pushl  (%eax)
  8012ec:	e8 cb fc ff ff       	call   800fbc <dev_lookup>
  8012f1:	83 c4 10             	add    $0x10,%esp
  8012f4:	85 c0                	test   %eax,%eax
  8012f6:	78 22                	js     80131a <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8012f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8012fb:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8012ff:	74 1e                	je     80131f <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801301:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801304:	8b 52 0c             	mov    0xc(%edx),%edx
  801307:	85 d2                	test   %edx,%edx
  801309:	74 35                	je     801340 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80130b:	83 ec 04             	sub    $0x4,%esp
  80130e:	ff 75 10             	pushl  0x10(%ebp)
  801311:	ff 75 0c             	pushl  0xc(%ebp)
  801314:	50                   	push   %eax
  801315:	ff d2                	call   *%edx
  801317:	83 c4 10             	add    $0x10,%esp
}
  80131a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80131d:	c9                   	leave  
  80131e:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  80131f:	a1 04 40 80 00       	mov    0x804004,%eax
  801324:	8b 40 48             	mov    0x48(%eax),%eax
  801327:	83 ec 04             	sub    $0x4,%esp
  80132a:	53                   	push   %ebx
  80132b:	50                   	push   %eax
  80132c:	68 79 24 80 00       	push   $0x802479
  801331:	e8 e0 ee ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  801336:	83 c4 10             	add    $0x10,%esp
  801339:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80133e:	eb da                	jmp    80131a <write+0x59>
		return -E_NOT_SUPP;
  801340:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801345:	eb d3                	jmp    80131a <write+0x59>

00801347 <seek>:

int
seek(int fdnum, off_t offset)
{
  801347:	f3 0f 1e fb          	endbr32 
  80134b:	55                   	push   %ebp
  80134c:	89 e5                	mov    %esp,%ebp
  80134e:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801351:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801354:	50                   	push   %eax
  801355:	ff 75 08             	pushl  0x8(%ebp)
  801358:	e8 0b fc ff ff       	call   800f68 <fd_lookup>
  80135d:	83 c4 10             	add    $0x10,%esp
  801360:	85 c0                	test   %eax,%eax
  801362:	78 0e                	js     801372 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801364:	8b 55 0c             	mov    0xc(%ebp),%edx
  801367:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80136a:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  80136d:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801372:	c9                   	leave  
  801373:	c3                   	ret    

00801374 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  801374:	f3 0f 1e fb          	endbr32 
  801378:	55                   	push   %ebp
  801379:	89 e5                	mov    %esp,%ebp
  80137b:	53                   	push   %ebx
  80137c:	83 ec 1c             	sub    $0x1c,%esp
  80137f:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801382:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801385:	50                   	push   %eax
  801386:	53                   	push   %ebx
  801387:	e8 dc fb ff ff       	call   800f68 <fd_lookup>
  80138c:	83 c4 10             	add    $0x10,%esp
  80138f:	85 c0                	test   %eax,%eax
  801391:	78 37                	js     8013ca <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801393:	83 ec 08             	sub    $0x8,%esp
  801396:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801399:	50                   	push   %eax
  80139a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80139d:	ff 30                	pushl  (%eax)
  80139f:	e8 18 fc ff ff       	call   800fbc <dev_lookup>
  8013a4:	83 c4 10             	add    $0x10,%esp
  8013a7:	85 c0                	test   %eax,%eax
  8013a9:	78 1f                	js     8013ca <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8013ab:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013ae:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8013b2:	74 1b                	je     8013cf <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8013b4:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8013b7:	8b 52 18             	mov    0x18(%edx),%edx
  8013ba:	85 d2                	test   %edx,%edx
  8013bc:	74 32                	je     8013f0 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8013be:	83 ec 08             	sub    $0x8,%esp
  8013c1:	ff 75 0c             	pushl  0xc(%ebp)
  8013c4:	50                   	push   %eax
  8013c5:	ff d2                	call   *%edx
  8013c7:	83 c4 10             	add    $0x10,%esp
}
  8013ca:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013cd:	c9                   	leave  
  8013ce:	c3                   	ret    
			thisenv->env_id, fdnum);
  8013cf:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8013d4:	8b 40 48             	mov    0x48(%eax),%eax
  8013d7:	83 ec 04             	sub    $0x4,%esp
  8013da:	53                   	push   %ebx
  8013db:	50                   	push   %eax
  8013dc:	68 3c 24 80 00       	push   $0x80243c
  8013e1:	e8 30 ee ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  8013e6:	83 c4 10             	add    $0x10,%esp
  8013e9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8013ee:	eb da                	jmp    8013ca <ftruncate+0x56>
		return -E_NOT_SUPP;
  8013f0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8013f5:	eb d3                	jmp    8013ca <ftruncate+0x56>

008013f7 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8013f7:	f3 0f 1e fb          	endbr32 
  8013fb:	55                   	push   %ebp
  8013fc:	89 e5                	mov    %esp,%ebp
  8013fe:	53                   	push   %ebx
  8013ff:	83 ec 1c             	sub    $0x1c,%esp
  801402:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801405:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801408:	50                   	push   %eax
  801409:	ff 75 08             	pushl  0x8(%ebp)
  80140c:	e8 57 fb ff ff       	call   800f68 <fd_lookup>
  801411:	83 c4 10             	add    $0x10,%esp
  801414:	85 c0                	test   %eax,%eax
  801416:	78 4b                	js     801463 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801418:	83 ec 08             	sub    $0x8,%esp
  80141b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80141e:	50                   	push   %eax
  80141f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801422:	ff 30                	pushl  (%eax)
  801424:	e8 93 fb ff ff       	call   800fbc <dev_lookup>
  801429:	83 c4 10             	add    $0x10,%esp
  80142c:	85 c0                	test   %eax,%eax
  80142e:	78 33                	js     801463 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801430:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801433:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801437:	74 2f                	je     801468 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801439:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  80143c:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801443:	00 00 00 
	stat->st_isdir = 0;
  801446:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80144d:	00 00 00 
	stat->st_dev = dev;
  801450:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801456:	83 ec 08             	sub    $0x8,%esp
  801459:	53                   	push   %ebx
  80145a:	ff 75 f0             	pushl  -0x10(%ebp)
  80145d:	ff 50 14             	call   *0x14(%eax)
  801460:	83 c4 10             	add    $0x10,%esp
}
  801463:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801466:	c9                   	leave  
  801467:	c3                   	ret    
		return -E_NOT_SUPP;
  801468:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80146d:	eb f4                	jmp    801463 <fstat+0x6c>

0080146f <stat>:

int
stat(const char *path, struct Stat *stat)
{
  80146f:	f3 0f 1e fb          	endbr32 
  801473:	55                   	push   %ebp
  801474:	89 e5                	mov    %esp,%ebp
  801476:	56                   	push   %esi
  801477:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801478:	83 ec 08             	sub    $0x8,%esp
  80147b:	6a 00                	push   $0x0
  80147d:	ff 75 08             	pushl  0x8(%ebp)
  801480:	e8 fb 01 00 00       	call   801680 <open>
  801485:	89 c3                	mov    %eax,%ebx
  801487:	83 c4 10             	add    $0x10,%esp
  80148a:	85 c0                	test   %eax,%eax
  80148c:	78 1b                	js     8014a9 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  80148e:	83 ec 08             	sub    $0x8,%esp
  801491:	ff 75 0c             	pushl  0xc(%ebp)
  801494:	50                   	push   %eax
  801495:	e8 5d ff ff ff       	call   8013f7 <fstat>
  80149a:	89 c6                	mov    %eax,%esi
	close(fd);
  80149c:	89 1c 24             	mov    %ebx,(%esp)
  80149f:	e8 fd fb ff ff       	call   8010a1 <close>
	return r;
  8014a4:	83 c4 10             	add    $0x10,%esp
  8014a7:	89 f3                	mov    %esi,%ebx
}
  8014a9:	89 d8                	mov    %ebx,%eax
  8014ab:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8014ae:	5b                   	pop    %ebx
  8014af:	5e                   	pop    %esi
  8014b0:	5d                   	pop    %ebp
  8014b1:	c3                   	ret    

008014b2 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8014b2:	55                   	push   %ebp
  8014b3:	89 e5                	mov    %esp,%ebp
  8014b5:	56                   	push   %esi
  8014b6:	53                   	push   %ebx
  8014b7:	89 c6                	mov    %eax,%esi
  8014b9:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8014bb:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  8014c2:	74 27                	je     8014eb <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8014c4:	6a 07                	push   $0x7
  8014c6:	68 00 50 80 00       	push   $0x805000
  8014cb:	56                   	push   %esi
  8014cc:	ff 35 00 40 80 00    	pushl  0x804000
  8014d2:	e8 d2 07 00 00       	call   801ca9 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8014d7:	83 c4 0c             	add    $0xc,%esp
  8014da:	6a 00                	push   $0x0
  8014dc:	53                   	push   %ebx
  8014dd:	6a 00                	push   $0x0
  8014df:	e8 44 07 00 00       	call   801c28 <ipc_recv>
}
  8014e4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8014e7:	5b                   	pop    %ebx
  8014e8:	5e                   	pop    %esi
  8014e9:	5d                   	pop    %ebp
  8014ea:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8014eb:	83 ec 0c             	sub    $0xc,%esp
  8014ee:	6a 01                	push   $0x1
  8014f0:	e8 0c 08 00 00       	call   801d01 <ipc_find_env>
  8014f5:	a3 00 40 80 00       	mov    %eax,0x804000
  8014fa:	83 c4 10             	add    $0x10,%esp
  8014fd:	eb c5                	jmp    8014c4 <fsipc+0x12>

008014ff <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8014ff:	f3 0f 1e fb          	endbr32 
  801503:	55                   	push   %ebp
  801504:	89 e5                	mov    %esp,%ebp
  801506:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801509:	8b 45 08             	mov    0x8(%ebp),%eax
  80150c:	8b 40 0c             	mov    0xc(%eax),%eax
  80150f:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801514:	8b 45 0c             	mov    0xc(%ebp),%eax
  801517:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80151c:	ba 00 00 00 00       	mov    $0x0,%edx
  801521:	b8 02 00 00 00       	mov    $0x2,%eax
  801526:	e8 87 ff ff ff       	call   8014b2 <fsipc>
}
  80152b:	c9                   	leave  
  80152c:	c3                   	ret    

0080152d <devfile_flush>:
{
  80152d:	f3 0f 1e fb          	endbr32 
  801531:	55                   	push   %ebp
  801532:	89 e5                	mov    %esp,%ebp
  801534:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801537:	8b 45 08             	mov    0x8(%ebp),%eax
  80153a:	8b 40 0c             	mov    0xc(%eax),%eax
  80153d:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801542:	ba 00 00 00 00       	mov    $0x0,%edx
  801547:	b8 06 00 00 00       	mov    $0x6,%eax
  80154c:	e8 61 ff ff ff       	call   8014b2 <fsipc>
}
  801551:	c9                   	leave  
  801552:	c3                   	ret    

00801553 <devfile_stat>:
{
  801553:	f3 0f 1e fb          	endbr32 
  801557:	55                   	push   %ebp
  801558:	89 e5                	mov    %esp,%ebp
  80155a:	53                   	push   %ebx
  80155b:	83 ec 04             	sub    $0x4,%esp
  80155e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801561:	8b 45 08             	mov    0x8(%ebp),%eax
  801564:	8b 40 0c             	mov    0xc(%eax),%eax
  801567:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  80156c:	ba 00 00 00 00       	mov    $0x0,%edx
  801571:	b8 05 00 00 00       	mov    $0x5,%eax
  801576:	e8 37 ff ff ff       	call   8014b2 <fsipc>
  80157b:	85 c0                	test   %eax,%eax
  80157d:	78 2c                	js     8015ab <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  80157f:	83 ec 08             	sub    $0x8,%esp
  801582:	68 00 50 80 00       	push   $0x805000
  801587:	53                   	push   %ebx
  801588:	e8 62 f2 ff ff       	call   8007ef <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  80158d:	a1 80 50 80 00       	mov    0x805080,%eax
  801592:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801598:	a1 84 50 80 00       	mov    0x805084,%eax
  80159d:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8015a3:	83 c4 10             	add    $0x10,%esp
  8015a6:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015ab:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015ae:	c9                   	leave  
  8015af:	c3                   	ret    

008015b0 <devfile_write>:
{
  8015b0:	f3 0f 1e fb          	endbr32 
  8015b4:	55                   	push   %ebp
  8015b5:	89 e5                	mov    %esp,%ebp
  8015b7:	83 ec 0c             	sub    $0xc,%esp
  8015ba:	8b 45 10             	mov    0x10(%ebp),%eax
  8015bd:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  8015c2:	ba f8 0f 00 00       	mov    $0xff8,%edx
  8015c7:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  8015ca:	8b 55 08             	mov    0x8(%ebp),%edx
  8015cd:	8b 52 0c             	mov    0xc(%edx),%edx
  8015d0:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8015d6:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8015db:	50                   	push   %eax
  8015dc:	ff 75 0c             	pushl  0xc(%ebp)
  8015df:	68 08 50 80 00       	push   $0x805008
  8015e4:	e8 bc f3 ff ff       	call   8009a5 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8015e9:	ba 00 00 00 00       	mov    $0x0,%edx
  8015ee:	b8 04 00 00 00       	mov    $0x4,%eax
  8015f3:	e8 ba fe ff ff       	call   8014b2 <fsipc>
  8015f8:	c9                   	leave  
  8015f9:	c3                   	ret    

008015fa <devfile_read>:
{
  8015fa:	f3 0f 1e fb          	endbr32 
  8015fe:	55                   	push   %ebp
  8015ff:	89 e5                	mov    %esp,%ebp
  801601:	56                   	push   %esi
  801602:	53                   	push   %ebx
  801603:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801606:	8b 45 08             	mov    0x8(%ebp),%eax
  801609:	8b 40 0c             	mov    0xc(%eax),%eax
  80160c:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801611:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801617:	ba 00 00 00 00       	mov    $0x0,%edx
  80161c:	b8 03 00 00 00       	mov    $0x3,%eax
  801621:	e8 8c fe ff ff       	call   8014b2 <fsipc>
  801626:	89 c3                	mov    %eax,%ebx
  801628:	85 c0                	test   %eax,%eax
  80162a:	78 1f                	js     80164b <devfile_read+0x51>
	assert(r <= n);
  80162c:	39 f0                	cmp    %esi,%eax
  80162e:	77 24                	ja     801654 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801630:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801635:	7f 33                	jg     80166a <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801637:	83 ec 04             	sub    $0x4,%esp
  80163a:	50                   	push   %eax
  80163b:	68 00 50 80 00       	push   $0x805000
  801640:	ff 75 0c             	pushl  0xc(%ebp)
  801643:	e8 5d f3 ff ff       	call   8009a5 <memmove>
	return r;
  801648:	83 c4 10             	add    $0x10,%esp
}
  80164b:	89 d8                	mov    %ebx,%eax
  80164d:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801650:	5b                   	pop    %ebx
  801651:	5e                   	pop    %esi
  801652:	5d                   	pop    %ebp
  801653:	c3                   	ret    
	assert(r <= n);
  801654:	68 a8 24 80 00       	push   $0x8024a8
  801659:	68 af 24 80 00       	push   $0x8024af
  80165e:	6a 7c                	push   $0x7c
  801660:	68 c4 24 80 00       	push   $0x8024c4
  801665:	e8 c5 ea ff ff       	call   80012f <_panic>
	assert(r <= PGSIZE);
  80166a:	68 cf 24 80 00       	push   $0x8024cf
  80166f:	68 af 24 80 00       	push   $0x8024af
  801674:	6a 7d                	push   $0x7d
  801676:	68 c4 24 80 00       	push   $0x8024c4
  80167b:	e8 af ea ff ff       	call   80012f <_panic>

00801680 <open>:
{
  801680:	f3 0f 1e fb          	endbr32 
  801684:	55                   	push   %ebp
  801685:	89 e5                	mov    %esp,%ebp
  801687:	56                   	push   %esi
  801688:	53                   	push   %ebx
  801689:	83 ec 1c             	sub    $0x1c,%esp
  80168c:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  80168f:	56                   	push   %esi
  801690:	e8 17 f1 ff ff       	call   8007ac <strlen>
  801695:	83 c4 10             	add    $0x10,%esp
  801698:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  80169d:	7f 6c                	jg     80170b <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  80169f:	83 ec 0c             	sub    $0xc,%esp
  8016a2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016a5:	50                   	push   %eax
  8016a6:	e8 67 f8 ff ff       	call   800f12 <fd_alloc>
  8016ab:	89 c3                	mov    %eax,%ebx
  8016ad:	83 c4 10             	add    $0x10,%esp
  8016b0:	85 c0                	test   %eax,%eax
  8016b2:	78 3c                	js     8016f0 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  8016b4:	83 ec 08             	sub    $0x8,%esp
  8016b7:	56                   	push   %esi
  8016b8:	68 00 50 80 00       	push   $0x805000
  8016bd:	e8 2d f1 ff ff       	call   8007ef <strcpy>
	fsipcbuf.open.req_omode = mode;
  8016c2:	8b 45 0c             	mov    0xc(%ebp),%eax
  8016c5:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  8016ca:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016cd:	b8 01 00 00 00       	mov    $0x1,%eax
  8016d2:	e8 db fd ff ff       	call   8014b2 <fsipc>
  8016d7:	89 c3                	mov    %eax,%ebx
  8016d9:	83 c4 10             	add    $0x10,%esp
  8016dc:	85 c0                	test   %eax,%eax
  8016de:	78 19                	js     8016f9 <open+0x79>
	return fd2num(fd);
  8016e0:	83 ec 0c             	sub    $0xc,%esp
  8016e3:	ff 75 f4             	pushl  -0xc(%ebp)
  8016e6:	e8 f8 f7 ff ff       	call   800ee3 <fd2num>
  8016eb:	89 c3                	mov    %eax,%ebx
  8016ed:	83 c4 10             	add    $0x10,%esp
}
  8016f0:	89 d8                	mov    %ebx,%eax
  8016f2:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8016f5:	5b                   	pop    %ebx
  8016f6:	5e                   	pop    %esi
  8016f7:	5d                   	pop    %ebp
  8016f8:	c3                   	ret    
		fd_close(fd, 0);
  8016f9:	83 ec 08             	sub    $0x8,%esp
  8016fc:	6a 00                	push   $0x0
  8016fe:	ff 75 f4             	pushl  -0xc(%ebp)
  801701:	e8 10 f9 ff ff       	call   801016 <fd_close>
		return r;
  801706:	83 c4 10             	add    $0x10,%esp
  801709:	eb e5                	jmp    8016f0 <open+0x70>
		return -E_BAD_PATH;
  80170b:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801710:	eb de                	jmp    8016f0 <open+0x70>

00801712 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801712:	f3 0f 1e fb          	endbr32 
  801716:	55                   	push   %ebp
  801717:	89 e5                	mov    %esp,%ebp
  801719:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  80171c:	ba 00 00 00 00       	mov    $0x0,%edx
  801721:	b8 08 00 00 00       	mov    $0x8,%eax
  801726:	e8 87 fd ff ff       	call   8014b2 <fsipc>
}
  80172b:	c9                   	leave  
  80172c:	c3                   	ret    

0080172d <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  80172d:	f3 0f 1e fb          	endbr32 
  801731:	55                   	push   %ebp
  801732:	89 e5                	mov    %esp,%ebp
  801734:	56                   	push   %esi
  801735:	53                   	push   %ebx
  801736:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801739:	83 ec 0c             	sub    $0xc,%esp
  80173c:	ff 75 08             	pushl  0x8(%ebp)
  80173f:	e8 b3 f7 ff ff       	call   800ef7 <fd2data>
  801744:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801746:	83 c4 08             	add    $0x8,%esp
  801749:	68 db 24 80 00       	push   $0x8024db
  80174e:	53                   	push   %ebx
  80174f:	e8 9b f0 ff ff       	call   8007ef <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801754:	8b 46 04             	mov    0x4(%esi),%eax
  801757:	2b 06                	sub    (%esi),%eax
  801759:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  80175f:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801766:	00 00 00 
	stat->st_dev = &devpipe;
  801769:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801770:	30 80 00 
	return 0;
}
  801773:	b8 00 00 00 00       	mov    $0x0,%eax
  801778:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80177b:	5b                   	pop    %ebx
  80177c:	5e                   	pop    %esi
  80177d:	5d                   	pop    %ebp
  80177e:	c3                   	ret    

0080177f <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  80177f:	f3 0f 1e fb          	endbr32 
  801783:	55                   	push   %ebp
  801784:	89 e5                	mov    %esp,%ebp
  801786:	53                   	push   %ebx
  801787:	83 ec 0c             	sub    $0xc,%esp
  80178a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  80178d:	53                   	push   %ebx
  80178e:	6a 00                	push   $0x0
  801790:	e8 29 f5 ff ff       	call   800cbe <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801795:	89 1c 24             	mov    %ebx,(%esp)
  801798:	e8 5a f7 ff ff       	call   800ef7 <fd2data>
  80179d:	83 c4 08             	add    $0x8,%esp
  8017a0:	50                   	push   %eax
  8017a1:	6a 00                	push   $0x0
  8017a3:	e8 16 f5 ff ff       	call   800cbe <sys_page_unmap>
}
  8017a8:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8017ab:	c9                   	leave  
  8017ac:	c3                   	ret    

008017ad <_pipeisclosed>:
{
  8017ad:	55                   	push   %ebp
  8017ae:	89 e5                	mov    %esp,%ebp
  8017b0:	57                   	push   %edi
  8017b1:	56                   	push   %esi
  8017b2:	53                   	push   %ebx
  8017b3:	83 ec 1c             	sub    $0x1c,%esp
  8017b6:	89 c7                	mov    %eax,%edi
  8017b8:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  8017ba:	a1 04 40 80 00       	mov    0x804004,%eax
  8017bf:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  8017c2:	83 ec 0c             	sub    $0xc,%esp
  8017c5:	57                   	push   %edi
  8017c6:	e8 73 05 00 00       	call   801d3e <pageref>
  8017cb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8017ce:	89 34 24             	mov    %esi,(%esp)
  8017d1:	e8 68 05 00 00       	call   801d3e <pageref>
		nn = thisenv->env_runs;
  8017d6:	8b 15 04 40 80 00    	mov    0x804004,%edx
  8017dc:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  8017df:	83 c4 10             	add    $0x10,%esp
  8017e2:	39 cb                	cmp    %ecx,%ebx
  8017e4:	74 1b                	je     801801 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  8017e6:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  8017e9:	75 cf                	jne    8017ba <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  8017eb:	8b 42 58             	mov    0x58(%edx),%eax
  8017ee:	6a 01                	push   $0x1
  8017f0:	50                   	push   %eax
  8017f1:	53                   	push   %ebx
  8017f2:	68 e2 24 80 00       	push   $0x8024e2
  8017f7:	e8 1a ea ff ff       	call   800216 <cprintf>
  8017fc:	83 c4 10             	add    $0x10,%esp
  8017ff:	eb b9                	jmp    8017ba <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801801:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801804:	0f 94 c0             	sete   %al
  801807:	0f b6 c0             	movzbl %al,%eax
}
  80180a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80180d:	5b                   	pop    %ebx
  80180e:	5e                   	pop    %esi
  80180f:	5f                   	pop    %edi
  801810:	5d                   	pop    %ebp
  801811:	c3                   	ret    

00801812 <devpipe_write>:
{
  801812:	f3 0f 1e fb          	endbr32 
  801816:	55                   	push   %ebp
  801817:	89 e5                	mov    %esp,%ebp
  801819:	57                   	push   %edi
  80181a:	56                   	push   %esi
  80181b:	53                   	push   %ebx
  80181c:	83 ec 28             	sub    $0x28,%esp
  80181f:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801822:	56                   	push   %esi
  801823:	e8 cf f6 ff ff       	call   800ef7 <fd2data>
  801828:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  80182a:	83 c4 10             	add    $0x10,%esp
  80182d:	bf 00 00 00 00       	mov    $0x0,%edi
  801832:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801835:	74 4f                	je     801886 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801837:	8b 43 04             	mov    0x4(%ebx),%eax
  80183a:	8b 0b                	mov    (%ebx),%ecx
  80183c:	8d 51 20             	lea    0x20(%ecx),%edx
  80183f:	39 d0                	cmp    %edx,%eax
  801841:	72 14                	jb     801857 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801843:	89 da                	mov    %ebx,%edx
  801845:	89 f0                	mov    %esi,%eax
  801847:	e8 61 ff ff ff       	call   8017ad <_pipeisclosed>
  80184c:	85 c0                	test   %eax,%eax
  80184e:	75 3b                	jne    80188b <devpipe_write+0x79>
			sys_yield();
  801850:	e8 b9 f3 ff ff       	call   800c0e <sys_yield>
  801855:	eb e0                	jmp    801837 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801857:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80185a:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  80185e:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801861:	89 c2                	mov    %eax,%edx
  801863:	c1 fa 1f             	sar    $0x1f,%edx
  801866:	89 d1                	mov    %edx,%ecx
  801868:	c1 e9 1b             	shr    $0x1b,%ecx
  80186b:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  80186e:	83 e2 1f             	and    $0x1f,%edx
  801871:	29 ca                	sub    %ecx,%edx
  801873:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801877:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  80187b:	83 c0 01             	add    $0x1,%eax
  80187e:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801881:	83 c7 01             	add    $0x1,%edi
  801884:	eb ac                	jmp    801832 <devpipe_write+0x20>
	return i;
  801886:	8b 45 10             	mov    0x10(%ebp),%eax
  801889:	eb 05                	jmp    801890 <devpipe_write+0x7e>
				return 0;
  80188b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801890:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801893:	5b                   	pop    %ebx
  801894:	5e                   	pop    %esi
  801895:	5f                   	pop    %edi
  801896:	5d                   	pop    %ebp
  801897:	c3                   	ret    

00801898 <devpipe_read>:
{
  801898:	f3 0f 1e fb          	endbr32 
  80189c:	55                   	push   %ebp
  80189d:	89 e5                	mov    %esp,%ebp
  80189f:	57                   	push   %edi
  8018a0:	56                   	push   %esi
  8018a1:	53                   	push   %ebx
  8018a2:	83 ec 18             	sub    $0x18,%esp
  8018a5:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  8018a8:	57                   	push   %edi
  8018a9:	e8 49 f6 ff ff       	call   800ef7 <fd2data>
  8018ae:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  8018b0:	83 c4 10             	add    $0x10,%esp
  8018b3:	be 00 00 00 00       	mov    $0x0,%esi
  8018b8:	3b 75 10             	cmp    0x10(%ebp),%esi
  8018bb:	75 14                	jne    8018d1 <devpipe_read+0x39>
	return i;
  8018bd:	8b 45 10             	mov    0x10(%ebp),%eax
  8018c0:	eb 02                	jmp    8018c4 <devpipe_read+0x2c>
				return i;
  8018c2:	89 f0                	mov    %esi,%eax
}
  8018c4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8018c7:	5b                   	pop    %ebx
  8018c8:	5e                   	pop    %esi
  8018c9:	5f                   	pop    %edi
  8018ca:	5d                   	pop    %ebp
  8018cb:	c3                   	ret    
			sys_yield();
  8018cc:	e8 3d f3 ff ff       	call   800c0e <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  8018d1:	8b 03                	mov    (%ebx),%eax
  8018d3:	3b 43 04             	cmp    0x4(%ebx),%eax
  8018d6:	75 18                	jne    8018f0 <devpipe_read+0x58>
			if (i > 0)
  8018d8:	85 f6                	test   %esi,%esi
  8018da:	75 e6                	jne    8018c2 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  8018dc:	89 da                	mov    %ebx,%edx
  8018de:	89 f8                	mov    %edi,%eax
  8018e0:	e8 c8 fe ff ff       	call   8017ad <_pipeisclosed>
  8018e5:	85 c0                	test   %eax,%eax
  8018e7:	74 e3                	je     8018cc <devpipe_read+0x34>
				return 0;
  8018e9:	b8 00 00 00 00       	mov    $0x0,%eax
  8018ee:	eb d4                	jmp    8018c4 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  8018f0:	99                   	cltd   
  8018f1:	c1 ea 1b             	shr    $0x1b,%edx
  8018f4:	01 d0                	add    %edx,%eax
  8018f6:	83 e0 1f             	and    $0x1f,%eax
  8018f9:	29 d0                	sub    %edx,%eax
  8018fb:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801900:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801903:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801906:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801909:	83 c6 01             	add    $0x1,%esi
  80190c:	eb aa                	jmp    8018b8 <devpipe_read+0x20>

0080190e <pipe>:
{
  80190e:	f3 0f 1e fb          	endbr32 
  801912:	55                   	push   %ebp
  801913:	89 e5                	mov    %esp,%ebp
  801915:	56                   	push   %esi
  801916:	53                   	push   %ebx
  801917:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  80191a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80191d:	50                   	push   %eax
  80191e:	e8 ef f5 ff ff       	call   800f12 <fd_alloc>
  801923:	89 c3                	mov    %eax,%ebx
  801925:	83 c4 10             	add    $0x10,%esp
  801928:	85 c0                	test   %eax,%eax
  80192a:	0f 88 23 01 00 00    	js     801a53 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801930:	83 ec 04             	sub    $0x4,%esp
  801933:	68 07 04 00 00       	push   $0x407
  801938:	ff 75 f4             	pushl  -0xc(%ebp)
  80193b:	6a 00                	push   $0x0
  80193d:	e8 ef f2 ff ff       	call   800c31 <sys_page_alloc>
  801942:	89 c3                	mov    %eax,%ebx
  801944:	83 c4 10             	add    $0x10,%esp
  801947:	85 c0                	test   %eax,%eax
  801949:	0f 88 04 01 00 00    	js     801a53 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  80194f:	83 ec 0c             	sub    $0xc,%esp
  801952:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801955:	50                   	push   %eax
  801956:	e8 b7 f5 ff ff       	call   800f12 <fd_alloc>
  80195b:	89 c3                	mov    %eax,%ebx
  80195d:	83 c4 10             	add    $0x10,%esp
  801960:	85 c0                	test   %eax,%eax
  801962:	0f 88 db 00 00 00    	js     801a43 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801968:	83 ec 04             	sub    $0x4,%esp
  80196b:	68 07 04 00 00       	push   $0x407
  801970:	ff 75 f0             	pushl  -0x10(%ebp)
  801973:	6a 00                	push   $0x0
  801975:	e8 b7 f2 ff ff       	call   800c31 <sys_page_alloc>
  80197a:	89 c3                	mov    %eax,%ebx
  80197c:	83 c4 10             	add    $0x10,%esp
  80197f:	85 c0                	test   %eax,%eax
  801981:	0f 88 bc 00 00 00    	js     801a43 <pipe+0x135>
	va = fd2data(fd0);
  801987:	83 ec 0c             	sub    $0xc,%esp
  80198a:	ff 75 f4             	pushl  -0xc(%ebp)
  80198d:	e8 65 f5 ff ff       	call   800ef7 <fd2data>
  801992:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801994:	83 c4 0c             	add    $0xc,%esp
  801997:	68 07 04 00 00       	push   $0x407
  80199c:	50                   	push   %eax
  80199d:	6a 00                	push   $0x0
  80199f:	e8 8d f2 ff ff       	call   800c31 <sys_page_alloc>
  8019a4:	89 c3                	mov    %eax,%ebx
  8019a6:	83 c4 10             	add    $0x10,%esp
  8019a9:	85 c0                	test   %eax,%eax
  8019ab:	0f 88 82 00 00 00    	js     801a33 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8019b1:	83 ec 0c             	sub    $0xc,%esp
  8019b4:	ff 75 f0             	pushl  -0x10(%ebp)
  8019b7:	e8 3b f5 ff ff       	call   800ef7 <fd2data>
  8019bc:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  8019c3:	50                   	push   %eax
  8019c4:	6a 00                	push   $0x0
  8019c6:	56                   	push   %esi
  8019c7:	6a 00                	push   $0x0
  8019c9:	e8 aa f2 ff ff       	call   800c78 <sys_page_map>
  8019ce:	89 c3                	mov    %eax,%ebx
  8019d0:	83 c4 20             	add    $0x20,%esp
  8019d3:	85 c0                	test   %eax,%eax
  8019d5:	78 4e                	js     801a25 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  8019d7:	a1 20 30 80 00       	mov    0x803020,%eax
  8019dc:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8019df:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  8019e1:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8019e4:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  8019eb:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8019ee:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  8019f0:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8019f3:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  8019fa:	83 ec 0c             	sub    $0xc,%esp
  8019fd:	ff 75 f4             	pushl  -0xc(%ebp)
  801a00:	e8 de f4 ff ff       	call   800ee3 <fd2num>
  801a05:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801a08:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801a0a:	83 c4 04             	add    $0x4,%esp
  801a0d:	ff 75 f0             	pushl  -0x10(%ebp)
  801a10:	e8 ce f4 ff ff       	call   800ee3 <fd2num>
  801a15:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801a18:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801a1b:	83 c4 10             	add    $0x10,%esp
  801a1e:	bb 00 00 00 00       	mov    $0x0,%ebx
  801a23:	eb 2e                	jmp    801a53 <pipe+0x145>
	sys_page_unmap(0, va);
  801a25:	83 ec 08             	sub    $0x8,%esp
  801a28:	56                   	push   %esi
  801a29:	6a 00                	push   $0x0
  801a2b:	e8 8e f2 ff ff       	call   800cbe <sys_page_unmap>
  801a30:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801a33:	83 ec 08             	sub    $0x8,%esp
  801a36:	ff 75 f0             	pushl  -0x10(%ebp)
  801a39:	6a 00                	push   $0x0
  801a3b:	e8 7e f2 ff ff       	call   800cbe <sys_page_unmap>
  801a40:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801a43:	83 ec 08             	sub    $0x8,%esp
  801a46:	ff 75 f4             	pushl  -0xc(%ebp)
  801a49:	6a 00                	push   $0x0
  801a4b:	e8 6e f2 ff ff       	call   800cbe <sys_page_unmap>
  801a50:	83 c4 10             	add    $0x10,%esp
}
  801a53:	89 d8                	mov    %ebx,%eax
  801a55:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a58:	5b                   	pop    %ebx
  801a59:	5e                   	pop    %esi
  801a5a:	5d                   	pop    %ebp
  801a5b:	c3                   	ret    

00801a5c <pipeisclosed>:
{
  801a5c:	f3 0f 1e fb          	endbr32 
  801a60:	55                   	push   %ebp
  801a61:	89 e5                	mov    %esp,%ebp
  801a63:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801a66:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a69:	50                   	push   %eax
  801a6a:	ff 75 08             	pushl  0x8(%ebp)
  801a6d:	e8 f6 f4 ff ff       	call   800f68 <fd_lookup>
  801a72:	83 c4 10             	add    $0x10,%esp
  801a75:	85 c0                	test   %eax,%eax
  801a77:	78 18                	js     801a91 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801a79:	83 ec 0c             	sub    $0xc,%esp
  801a7c:	ff 75 f4             	pushl  -0xc(%ebp)
  801a7f:	e8 73 f4 ff ff       	call   800ef7 <fd2data>
  801a84:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801a86:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a89:	e8 1f fd ff ff       	call   8017ad <_pipeisclosed>
  801a8e:	83 c4 10             	add    $0x10,%esp
}
  801a91:	c9                   	leave  
  801a92:	c3                   	ret    

00801a93 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801a93:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801a97:	b8 00 00 00 00       	mov    $0x0,%eax
  801a9c:	c3                   	ret    

00801a9d <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801a9d:	f3 0f 1e fb          	endbr32 
  801aa1:	55                   	push   %ebp
  801aa2:	89 e5                	mov    %esp,%ebp
  801aa4:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801aa7:	68 fa 24 80 00       	push   $0x8024fa
  801aac:	ff 75 0c             	pushl  0xc(%ebp)
  801aaf:	e8 3b ed ff ff       	call   8007ef <strcpy>
	return 0;
}
  801ab4:	b8 00 00 00 00       	mov    $0x0,%eax
  801ab9:	c9                   	leave  
  801aba:	c3                   	ret    

00801abb <devcons_write>:
{
  801abb:	f3 0f 1e fb          	endbr32 
  801abf:	55                   	push   %ebp
  801ac0:	89 e5                	mov    %esp,%ebp
  801ac2:	57                   	push   %edi
  801ac3:	56                   	push   %esi
  801ac4:	53                   	push   %ebx
  801ac5:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801acb:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ad0:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801ad6:	3b 75 10             	cmp    0x10(%ebp),%esi
  801ad9:	73 31                	jae    801b0c <devcons_write+0x51>
		m = n - tot;
  801adb:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801ade:	29 f3                	sub    %esi,%ebx
  801ae0:	83 fb 7f             	cmp    $0x7f,%ebx
  801ae3:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801ae8:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801aeb:	83 ec 04             	sub    $0x4,%esp
  801aee:	53                   	push   %ebx
  801aef:	89 f0                	mov    %esi,%eax
  801af1:	03 45 0c             	add    0xc(%ebp),%eax
  801af4:	50                   	push   %eax
  801af5:	57                   	push   %edi
  801af6:	e8 aa ee ff ff       	call   8009a5 <memmove>
		sys_cputs(buf, m);
  801afb:	83 c4 08             	add    $0x8,%esp
  801afe:	53                   	push   %ebx
  801aff:	57                   	push   %edi
  801b00:	e8 5c f0 ff ff       	call   800b61 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801b05:	01 de                	add    %ebx,%esi
  801b07:	83 c4 10             	add    $0x10,%esp
  801b0a:	eb ca                	jmp    801ad6 <devcons_write+0x1b>
}
  801b0c:	89 f0                	mov    %esi,%eax
  801b0e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b11:	5b                   	pop    %ebx
  801b12:	5e                   	pop    %esi
  801b13:	5f                   	pop    %edi
  801b14:	5d                   	pop    %ebp
  801b15:	c3                   	ret    

00801b16 <devcons_read>:
{
  801b16:	f3 0f 1e fb          	endbr32 
  801b1a:	55                   	push   %ebp
  801b1b:	89 e5                	mov    %esp,%ebp
  801b1d:	83 ec 08             	sub    $0x8,%esp
  801b20:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801b25:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801b29:	74 21                	je     801b4c <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801b2b:	e8 53 f0 ff ff       	call   800b83 <sys_cgetc>
  801b30:	85 c0                	test   %eax,%eax
  801b32:	75 07                	jne    801b3b <devcons_read+0x25>
		sys_yield();
  801b34:	e8 d5 f0 ff ff       	call   800c0e <sys_yield>
  801b39:	eb f0                	jmp    801b2b <devcons_read+0x15>
	if (c < 0)
  801b3b:	78 0f                	js     801b4c <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801b3d:	83 f8 04             	cmp    $0x4,%eax
  801b40:	74 0c                	je     801b4e <devcons_read+0x38>
	*(char*)vbuf = c;
  801b42:	8b 55 0c             	mov    0xc(%ebp),%edx
  801b45:	88 02                	mov    %al,(%edx)
	return 1;
  801b47:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801b4c:	c9                   	leave  
  801b4d:	c3                   	ret    
		return 0;
  801b4e:	b8 00 00 00 00       	mov    $0x0,%eax
  801b53:	eb f7                	jmp    801b4c <devcons_read+0x36>

00801b55 <cputchar>:
{
  801b55:	f3 0f 1e fb          	endbr32 
  801b59:	55                   	push   %ebp
  801b5a:	89 e5                	mov    %esp,%ebp
  801b5c:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801b5f:	8b 45 08             	mov    0x8(%ebp),%eax
  801b62:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801b65:	6a 01                	push   $0x1
  801b67:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801b6a:	50                   	push   %eax
  801b6b:	e8 f1 ef ff ff       	call   800b61 <sys_cputs>
}
  801b70:	83 c4 10             	add    $0x10,%esp
  801b73:	c9                   	leave  
  801b74:	c3                   	ret    

00801b75 <getchar>:
{
  801b75:	f3 0f 1e fb          	endbr32 
  801b79:	55                   	push   %ebp
  801b7a:	89 e5                	mov    %esp,%ebp
  801b7c:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801b7f:	6a 01                	push   $0x1
  801b81:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801b84:	50                   	push   %eax
  801b85:	6a 00                	push   $0x0
  801b87:	e8 5f f6 ff ff       	call   8011eb <read>
	if (r < 0)
  801b8c:	83 c4 10             	add    $0x10,%esp
  801b8f:	85 c0                	test   %eax,%eax
  801b91:	78 06                	js     801b99 <getchar+0x24>
	if (r < 1)
  801b93:	74 06                	je     801b9b <getchar+0x26>
	return c;
  801b95:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801b99:	c9                   	leave  
  801b9a:	c3                   	ret    
		return -E_EOF;
  801b9b:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801ba0:	eb f7                	jmp    801b99 <getchar+0x24>

00801ba2 <iscons>:
{
  801ba2:	f3 0f 1e fb          	endbr32 
  801ba6:	55                   	push   %ebp
  801ba7:	89 e5                	mov    %esp,%ebp
  801ba9:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801bac:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801baf:	50                   	push   %eax
  801bb0:	ff 75 08             	pushl  0x8(%ebp)
  801bb3:	e8 b0 f3 ff ff       	call   800f68 <fd_lookup>
  801bb8:	83 c4 10             	add    $0x10,%esp
  801bbb:	85 c0                	test   %eax,%eax
  801bbd:	78 11                	js     801bd0 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801bbf:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801bc2:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801bc8:	39 10                	cmp    %edx,(%eax)
  801bca:	0f 94 c0             	sete   %al
  801bcd:	0f b6 c0             	movzbl %al,%eax
}
  801bd0:	c9                   	leave  
  801bd1:	c3                   	ret    

00801bd2 <opencons>:
{
  801bd2:	f3 0f 1e fb          	endbr32 
  801bd6:	55                   	push   %ebp
  801bd7:	89 e5                	mov    %esp,%ebp
  801bd9:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801bdc:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801bdf:	50                   	push   %eax
  801be0:	e8 2d f3 ff ff       	call   800f12 <fd_alloc>
  801be5:	83 c4 10             	add    $0x10,%esp
  801be8:	85 c0                	test   %eax,%eax
  801bea:	78 3a                	js     801c26 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801bec:	83 ec 04             	sub    $0x4,%esp
  801bef:	68 07 04 00 00       	push   $0x407
  801bf4:	ff 75 f4             	pushl  -0xc(%ebp)
  801bf7:	6a 00                	push   $0x0
  801bf9:	e8 33 f0 ff ff       	call   800c31 <sys_page_alloc>
  801bfe:	83 c4 10             	add    $0x10,%esp
  801c01:	85 c0                	test   %eax,%eax
  801c03:	78 21                	js     801c26 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801c05:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c08:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801c0e:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801c10:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c13:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801c1a:	83 ec 0c             	sub    $0xc,%esp
  801c1d:	50                   	push   %eax
  801c1e:	e8 c0 f2 ff ff       	call   800ee3 <fd2num>
  801c23:	83 c4 10             	add    $0x10,%esp
}
  801c26:	c9                   	leave  
  801c27:	c3                   	ret    

00801c28 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801c28:	f3 0f 1e fb          	endbr32 
  801c2c:	55                   	push   %ebp
  801c2d:	89 e5                	mov    %esp,%ebp
  801c2f:	56                   	push   %esi
  801c30:	53                   	push   %ebx
  801c31:	8b 75 08             	mov    0x8(%ebp),%esi
  801c34:	8b 45 0c             	mov    0xc(%ebp),%eax
  801c37:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801c3a:	85 c0                	test   %eax,%eax
  801c3c:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801c41:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801c44:	83 ec 0c             	sub    $0xc,%esp
  801c47:	50                   	push   %eax
  801c48:	e8 b0 f1 ff ff       	call   800dfd <sys_ipc_recv>
  801c4d:	83 c4 10             	add    $0x10,%esp
  801c50:	85 c0                	test   %eax,%eax
  801c52:	78 3f                	js     801c93 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801c54:	e8 92 ef ff ff       	call   800beb <sys_getenvid>
  801c59:	25 ff 03 00 00       	and    $0x3ff,%eax
  801c5e:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801c61:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801c67:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801c6d:	85 f6                	test   %esi,%esi
  801c6f:	74 05                	je     801c76 <ipc_recv+0x4e>
  801c71:	8b 42 74             	mov    0x74(%edx),%eax
  801c74:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801c76:	85 db                	test   %ebx,%ebx
  801c78:	74 0a                	je     801c84 <ipc_recv+0x5c>
  801c7a:	a1 04 40 80 00       	mov    0x804004,%eax
  801c7f:	8b 40 78             	mov    0x78(%eax),%eax
  801c82:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801c84:	a1 04 40 80 00       	mov    0x804004,%eax
  801c89:	8b 40 70             	mov    0x70(%eax),%eax
}
  801c8c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801c8f:	5b                   	pop    %ebx
  801c90:	5e                   	pop    %esi
  801c91:	5d                   	pop    %ebp
  801c92:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801c93:	85 f6                	test   %esi,%esi
  801c95:	74 06                	je     801c9d <ipc_recv+0x75>
  801c97:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801c9d:	85 db                	test   %ebx,%ebx
  801c9f:	74 eb                	je     801c8c <ipc_recv+0x64>
  801ca1:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801ca7:	eb e3                	jmp    801c8c <ipc_recv+0x64>

00801ca9 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801ca9:	f3 0f 1e fb          	endbr32 
  801cad:	55                   	push   %ebp
  801cae:	89 e5                	mov    %esp,%ebp
  801cb0:	57                   	push   %edi
  801cb1:	56                   	push   %esi
  801cb2:	53                   	push   %ebx
  801cb3:	83 ec 0c             	sub    $0xc,%esp
  801cb6:	8b 7d 08             	mov    0x8(%ebp),%edi
  801cb9:	8b 75 0c             	mov    0xc(%ebp),%esi
  801cbc:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801cbf:	85 db                	test   %ebx,%ebx
  801cc1:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801cc6:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801cc9:	ff 75 14             	pushl  0x14(%ebp)
  801ccc:	53                   	push   %ebx
  801ccd:	56                   	push   %esi
  801cce:	57                   	push   %edi
  801ccf:	e8 02 f1 ff ff       	call   800dd6 <sys_ipc_try_send>
  801cd4:	83 c4 10             	add    $0x10,%esp
  801cd7:	85 c0                	test   %eax,%eax
  801cd9:	79 1e                	jns    801cf9 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801cdb:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801cde:	75 07                	jne    801ce7 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801ce0:	e8 29 ef ff ff       	call   800c0e <sys_yield>
  801ce5:	eb e2                	jmp    801cc9 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801ce7:	50                   	push   %eax
  801ce8:	68 06 25 80 00       	push   $0x802506
  801ced:	6a 3b                	push   $0x3b
  801cef:	68 1a 25 80 00       	push   $0x80251a
  801cf4:	e8 36 e4 ff ff       	call   80012f <_panic>
	}
}
  801cf9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801cfc:	5b                   	pop    %ebx
  801cfd:	5e                   	pop    %esi
  801cfe:	5f                   	pop    %edi
  801cff:	5d                   	pop    %ebp
  801d00:	c3                   	ret    

00801d01 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801d01:	f3 0f 1e fb          	endbr32 
  801d05:	55                   	push   %ebp
  801d06:	89 e5                	mov    %esp,%ebp
  801d08:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801d0b:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801d10:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801d13:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801d19:	8b 52 50             	mov    0x50(%edx),%edx
  801d1c:	39 ca                	cmp    %ecx,%edx
  801d1e:	74 11                	je     801d31 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801d20:	83 c0 01             	add    $0x1,%eax
  801d23:	3d 00 04 00 00       	cmp    $0x400,%eax
  801d28:	75 e6                	jne    801d10 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801d2a:	b8 00 00 00 00       	mov    $0x0,%eax
  801d2f:	eb 0b                	jmp    801d3c <ipc_find_env+0x3b>
			return envs[i].env_id;
  801d31:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801d34:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801d39:	8b 40 48             	mov    0x48(%eax),%eax
}
  801d3c:	5d                   	pop    %ebp
  801d3d:	c3                   	ret    

00801d3e <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801d3e:	f3 0f 1e fb          	endbr32 
  801d42:	55                   	push   %ebp
  801d43:	89 e5                	mov    %esp,%ebp
  801d45:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801d48:	89 c2                	mov    %eax,%edx
  801d4a:	c1 ea 16             	shr    $0x16,%edx
  801d4d:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801d54:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801d59:	f6 c1 01             	test   $0x1,%cl
  801d5c:	74 1c                	je     801d7a <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801d5e:	c1 e8 0c             	shr    $0xc,%eax
  801d61:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801d68:	a8 01                	test   $0x1,%al
  801d6a:	74 0e                	je     801d7a <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801d6c:	c1 e8 0c             	shr    $0xc,%eax
  801d6f:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801d76:	ef 
  801d77:	0f b7 d2             	movzwl %dx,%edx
}
  801d7a:	89 d0                	mov    %edx,%eax
  801d7c:	5d                   	pop    %ebp
  801d7d:	c3                   	ret    
  801d7e:	66 90                	xchg   %ax,%ax

00801d80 <__udivdi3>:
  801d80:	f3 0f 1e fb          	endbr32 
  801d84:	55                   	push   %ebp
  801d85:	57                   	push   %edi
  801d86:	56                   	push   %esi
  801d87:	53                   	push   %ebx
  801d88:	83 ec 1c             	sub    $0x1c,%esp
  801d8b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801d8f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801d93:	8b 74 24 34          	mov    0x34(%esp),%esi
  801d97:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801d9b:	85 d2                	test   %edx,%edx
  801d9d:	75 19                	jne    801db8 <__udivdi3+0x38>
  801d9f:	39 f3                	cmp    %esi,%ebx
  801da1:	76 4d                	jbe    801df0 <__udivdi3+0x70>
  801da3:	31 ff                	xor    %edi,%edi
  801da5:	89 e8                	mov    %ebp,%eax
  801da7:	89 f2                	mov    %esi,%edx
  801da9:	f7 f3                	div    %ebx
  801dab:	89 fa                	mov    %edi,%edx
  801dad:	83 c4 1c             	add    $0x1c,%esp
  801db0:	5b                   	pop    %ebx
  801db1:	5e                   	pop    %esi
  801db2:	5f                   	pop    %edi
  801db3:	5d                   	pop    %ebp
  801db4:	c3                   	ret    
  801db5:	8d 76 00             	lea    0x0(%esi),%esi
  801db8:	39 f2                	cmp    %esi,%edx
  801dba:	76 14                	jbe    801dd0 <__udivdi3+0x50>
  801dbc:	31 ff                	xor    %edi,%edi
  801dbe:	31 c0                	xor    %eax,%eax
  801dc0:	89 fa                	mov    %edi,%edx
  801dc2:	83 c4 1c             	add    $0x1c,%esp
  801dc5:	5b                   	pop    %ebx
  801dc6:	5e                   	pop    %esi
  801dc7:	5f                   	pop    %edi
  801dc8:	5d                   	pop    %ebp
  801dc9:	c3                   	ret    
  801dca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801dd0:	0f bd fa             	bsr    %edx,%edi
  801dd3:	83 f7 1f             	xor    $0x1f,%edi
  801dd6:	75 48                	jne    801e20 <__udivdi3+0xa0>
  801dd8:	39 f2                	cmp    %esi,%edx
  801dda:	72 06                	jb     801de2 <__udivdi3+0x62>
  801ddc:	31 c0                	xor    %eax,%eax
  801dde:	39 eb                	cmp    %ebp,%ebx
  801de0:	77 de                	ja     801dc0 <__udivdi3+0x40>
  801de2:	b8 01 00 00 00       	mov    $0x1,%eax
  801de7:	eb d7                	jmp    801dc0 <__udivdi3+0x40>
  801de9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801df0:	89 d9                	mov    %ebx,%ecx
  801df2:	85 db                	test   %ebx,%ebx
  801df4:	75 0b                	jne    801e01 <__udivdi3+0x81>
  801df6:	b8 01 00 00 00       	mov    $0x1,%eax
  801dfb:	31 d2                	xor    %edx,%edx
  801dfd:	f7 f3                	div    %ebx
  801dff:	89 c1                	mov    %eax,%ecx
  801e01:	31 d2                	xor    %edx,%edx
  801e03:	89 f0                	mov    %esi,%eax
  801e05:	f7 f1                	div    %ecx
  801e07:	89 c6                	mov    %eax,%esi
  801e09:	89 e8                	mov    %ebp,%eax
  801e0b:	89 f7                	mov    %esi,%edi
  801e0d:	f7 f1                	div    %ecx
  801e0f:	89 fa                	mov    %edi,%edx
  801e11:	83 c4 1c             	add    $0x1c,%esp
  801e14:	5b                   	pop    %ebx
  801e15:	5e                   	pop    %esi
  801e16:	5f                   	pop    %edi
  801e17:	5d                   	pop    %ebp
  801e18:	c3                   	ret    
  801e19:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801e20:	89 f9                	mov    %edi,%ecx
  801e22:	b8 20 00 00 00       	mov    $0x20,%eax
  801e27:	29 f8                	sub    %edi,%eax
  801e29:	d3 e2                	shl    %cl,%edx
  801e2b:	89 54 24 08          	mov    %edx,0x8(%esp)
  801e2f:	89 c1                	mov    %eax,%ecx
  801e31:	89 da                	mov    %ebx,%edx
  801e33:	d3 ea                	shr    %cl,%edx
  801e35:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801e39:	09 d1                	or     %edx,%ecx
  801e3b:	89 f2                	mov    %esi,%edx
  801e3d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801e41:	89 f9                	mov    %edi,%ecx
  801e43:	d3 e3                	shl    %cl,%ebx
  801e45:	89 c1                	mov    %eax,%ecx
  801e47:	d3 ea                	shr    %cl,%edx
  801e49:	89 f9                	mov    %edi,%ecx
  801e4b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  801e4f:	89 eb                	mov    %ebp,%ebx
  801e51:	d3 e6                	shl    %cl,%esi
  801e53:	89 c1                	mov    %eax,%ecx
  801e55:	d3 eb                	shr    %cl,%ebx
  801e57:	09 de                	or     %ebx,%esi
  801e59:	89 f0                	mov    %esi,%eax
  801e5b:	f7 74 24 08          	divl   0x8(%esp)
  801e5f:	89 d6                	mov    %edx,%esi
  801e61:	89 c3                	mov    %eax,%ebx
  801e63:	f7 64 24 0c          	mull   0xc(%esp)
  801e67:	39 d6                	cmp    %edx,%esi
  801e69:	72 15                	jb     801e80 <__udivdi3+0x100>
  801e6b:	89 f9                	mov    %edi,%ecx
  801e6d:	d3 e5                	shl    %cl,%ebp
  801e6f:	39 c5                	cmp    %eax,%ebp
  801e71:	73 04                	jae    801e77 <__udivdi3+0xf7>
  801e73:	39 d6                	cmp    %edx,%esi
  801e75:	74 09                	je     801e80 <__udivdi3+0x100>
  801e77:	89 d8                	mov    %ebx,%eax
  801e79:	31 ff                	xor    %edi,%edi
  801e7b:	e9 40 ff ff ff       	jmp    801dc0 <__udivdi3+0x40>
  801e80:	8d 43 ff             	lea    -0x1(%ebx),%eax
  801e83:	31 ff                	xor    %edi,%edi
  801e85:	e9 36 ff ff ff       	jmp    801dc0 <__udivdi3+0x40>
  801e8a:	66 90                	xchg   %ax,%ax
  801e8c:	66 90                	xchg   %ax,%ax
  801e8e:	66 90                	xchg   %ax,%ax

00801e90 <__umoddi3>:
  801e90:	f3 0f 1e fb          	endbr32 
  801e94:	55                   	push   %ebp
  801e95:	57                   	push   %edi
  801e96:	56                   	push   %esi
  801e97:	53                   	push   %ebx
  801e98:	83 ec 1c             	sub    $0x1c,%esp
  801e9b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  801e9f:	8b 74 24 30          	mov    0x30(%esp),%esi
  801ea3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  801ea7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  801eab:	85 c0                	test   %eax,%eax
  801ead:	75 19                	jne    801ec8 <__umoddi3+0x38>
  801eaf:	39 df                	cmp    %ebx,%edi
  801eb1:	76 5d                	jbe    801f10 <__umoddi3+0x80>
  801eb3:	89 f0                	mov    %esi,%eax
  801eb5:	89 da                	mov    %ebx,%edx
  801eb7:	f7 f7                	div    %edi
  801eb9:	89 d0                	mov    %edx,%eax
  801ebb:	31 d2                	xor    %edx,%edx
  801ebd:	83 c4 1c             	add    $0x1c,%esp
  801ec0:	5b                   	pop    %ebx
  801ec1:	5e                   	pop    %esi
  801ec2:	5f                   	pop    %edi
  801ec3:	5d                   	pop    %ebp
  801ec4:	c3                   	ret    
  801ec5:	8d 76 00             	lea    0x0(%esi),%esi
  801ec8:	89 f2                	mov    %esi,%edx
  801eca:	39 d8                	cmp    %ebx,%eax
  801ecc:	76 12                	jbe    801ee0 <__umoddi3+0x50>
  801ece:	89 f0                	mov    %esi,%eax
  801ed0:	89 da                	mov    %ebx,%edx
  801ed2:	83 c4 1c             	add    $0x1c,%esp
  801ed5:	5b                   	pop    %ebx
  801ed6:	5e                   	pop    %esi
  801ed7:	5f                   	pop    %edi
  801ed8:	5d                   	pop    %ebp
  801ed9:	c3                   	ret    
  801eda:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801ee0:	0f bd e8             	bsr    %eax,%ebp
  801ee3:	83 f5 1f             	xor    $0x1f,%ebp
  801ee6:	75 50                	jne    801f38 <__umoddi3+0xa8>
  801ee8:	39 d8                	cmp    %ebx,%eax
  801eea:	0f 82 e0 00 00 00    	jb     801fd0 <__umoddi3+0x140>
  801ef0:	89 d9                	mov    %ebx,%ecx
  801ef2:	39 f7                	cmp    %esi,%edi
  801ef4:	0f 86 d6 00 00 00    	jbe    801fd0 <__umoddi3+0x140>
  801efa:	89 d0                	mov    %edx,%eax
  801efc:	89 ca                	mov    %ecx,%edx
  801efe:	83 c4 1c             	add    $0x1c,%esp
  801f01:	5b                   	pop    %ebx
  801f02:	5e                   	pop    %esi
  801f03:	5f                   	pop    %edi
  801f04:	5d                   	pop    %ebp
  801f05:	c3                   	ret    
  801f06:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f0d:	8d 76 00             	lea    0x0(%esi),%esi
  801f10:	89 fd                	mov    %edi,%ebp
  801f12:	85 ff                	test   %edi,%edi
  801f14:	75 0b                	jne    801f21 <__umoddi3+0x91>
  801f16:	b8 01 00 00 00       	mov    $0x1,%eax
  801f1b:	31 d2                	xor    %edx,%edx
  801f1d:	f7 f7                	div    %edi
  801f1f:	89 c5                	mov    %eax,%ebp
  801f21:	89 d8                	mov    %ebx,%eax
  801f23:	31 d2                	xor    %edx,%edx
  801f25:	f7 f5                	div    %ebp
  801f27:	89 f0                	mov    %esi,%eax
  801f29:	f7 f5                	div    %ebp
  801f2b:	89 d0                	mov    %edx,%eax
  801f2d:	31 d2                	xor    %edx,%edx
  801f2f:	eb 8c                	jmp    801ebd <__umoddi3+0x2d>
  801f31:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f38:	89 e9                	mov    %ebp,%ecx
  801f3a:	ba 20 00 00 00       	mov    $0x20,%edx
  801f3f:	29 ea                	sub    %ebp,%edx
  801f41:	d3 e0                	shl    %cl,%eax
  801f43:	89 44 24 08          	mov    %eax,0x8(%esp)
  801f47:	89 d1                	mov    %edx,%ecx
  801f49:	89 f8                	mov    %edi,%eax
  801f4b:	d3 e8                	shr    %cl,%eax
  801f4d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801f51:	89 54 24 04          	mov    %edx,0x4(%esp)
  801f55:	8b 54 24 04          	mov    0x4(%esp),%edx
  801f59:	09 c1                	or     %eax,%ecx
  801f5b:	89 d8                	mov    %ebx,%eax
  801f5d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801f61:	89 e9                	mov    %ebp,%ecx
  801f63:	d3 e7                	shl    %cl,%edi
  801f65:	89 d1                	mov    %edx,%ecx
  801f67:	d3 e8                	shr    %cl,%eax
  801f69:	89 e9                	mov    %ebp,%ecx
  801f6b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  801f6f:	d3 e3                	shl    %cl,%ebx
  801f71:	89 c7                	mov    %eax,%edi
  801f73:	89 d1                	mov    %edx,%ecx
  801f75:	89 f0                	mov    %esi,%eax
  801f77:	d3 e8                	shr    %cl,%eax
  801f79:	89 e9                	mov    %ebp,%ecx
  801f7b:	89 fa                	mov    %edi,%edx
  801f7d:	d3 e6                	shl    %cl,%esi
  801f7f:	09 d8                	or     %ebx,%eax
  801f81:	f7 74 24 08          	divl   0x8(%esp)
  801f85:	89 d1                	mov    %edx,%ecx
  801f87:	89 f3                	mov    %esi,%ebx
  801f89:	f7 64 24 0c          	mull   0xc(%esp)
  801f8d:	89 c6                	mov    %eax,%esi
  801f8f:	89 d7                	mov    %edx,%edi
  801f91:	39 d1                	cmp    %edx,%ecx
  801f93:	72 06                	jb     801f9b <__umoddi3+0x10b>
  801f95:	75 10                	jne    801fa7 <__umoddi3+0x117>
  801f97:	39 c3                	cmp    %eax,%ebx
  801f99:	73 0c                	jae    801fa7 <__umoddi3+0x117>
  801f9b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  801f9f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  801fa3:	89 d7                	mov    %edx,%edi
  801fa5:	89 c6                	mov    %eax,%esi
  801fa7:	89 ca                	mov    %ecx,%edx
  801fa9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  801fae:	29 f3                	sub    %esi,%ebx
  801fb0:	19 fa                	sbb    %edi,%edx
  801fb2:	89 d0                	mov    %edx,%eax
  801fb4:	d3 e0                	shl    %cl,%eax
  801fb6:	89 e9                	mov    %ebp,%ecx
  801fb8:	d3 eb                	shr    %cl,%ebx
  801fba:	d3 ea                	shr    %cl,%edx
  801fbc:	09 d8                	or     %ebx,%eax
  801fbe:	83 c4 1c             	add    $0x1c,%esp
  801fc1:	5b                   	pop    %ebx
  801fc2:	5e                   	pop    %esi
  801fc3:	5f                   	pop    %edi
  801fc4:	5d                   	pop    %ebp
  801fc5:	c3                   	ret    
  801fc6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801fcd:	8d 76 00             	lea    0x0(%esi),%esi
  801fd0:	29 fe                	sub    %edi,%esi
  801fd2:	19 c3                	sbb    %eax,%ebx
  801fd4:	89 f2                	mov    %esi,%edx
  801fd6:	89 d9                	mov    %ebx,%ecx
  801fd8:	e9 1d ff ff ff       	jmp    801efa <__umoddi3+0x6a>
